[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2686 - in branches/pingus_sdl/src: . actions colliders com
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r2686 - in branches/pingus_sdl/src: . actions colliders components display editor gui input input/axes input/buttons input/pointers input/scrollers movers particles sound tinygettext worldmap worldobjs |
Date: |
Thu, 18 Jan 2007 03:09:21 -0000 |
Author: grumbel
Date: 2007-01-18 04:08:17 +0100 (Thu, 18 Jan 2007)
New Revision: 2686
Added:
branches/pingus_sdl/src/action_holder.cpp
branches/pingus_sdl/src/action_holder.hpp
branches/pingus_sdl/src/actions/angel.cpp
branches/pingus_sdl/src/actions/angel.hpp
branches/pingus_sdl/src/actions/basher.cpp
branches/pingus_sdl/src/actions/basher.hpp
branches/pingus_sdl/src/actions/blocker.cpp
branches/pingus_sdl/src/actions/blocker.hpp
branches/pingus_sdl/src/actions/boarder.cpp
branches/pingus_sdl/src/actions/boarder.hpp
branches/pingus_sdl/src/actions/bomber.cpp
branches/pingus_sdl/src/actions/bomber.hpp
branches/pingus_sdl/src/actions/bridger.cpp
branches/pingus_sdl/src/actions/bridger.hpp
branches/pingus_sdl/src/actions/climber.cpp
branches/pingus_sdl/src/actions/climber.hpp
branches/pingus_sdl/src/actions/digger.cpp
branches/pingus_sdl/src/actions/digger.hpp
branches/pingus_sdl/src/actions/drown.cpp
branches/pingus_sdl/src/actions/drown.hpp
branches/pingus_sdl/src/actions/exiter.cpp
branches/pingus_sdl/src/actions/exiter.hpp
branches/pingus_sdl/src/actions/faller.cpp
branches/pingus_sdl/src/actions/faller.hpp
branches/pingus_sdl/src/actions/floater.cpp
branches/pingus_sdl/src/actions/floater.hpp
branches/pingus_sdl/src/actions/jumper.cpp
branches/pingus_sdl/src/actions/jumper.hpp
branches/pingus_sdl/src/actions/laser_kill.cpp
branches/pingus_sdl/src/actions/laser_kill.hpp
branches/pingus_sdl/src/actions/miner.cpp
branches/pingus_sdl/src/actions/miner.hpp
branches/pingus_sdl/src/actions/rocket_launcher.cpp
branches/pingus_sdl/src/actions/rocket_launcher.hpp
branches/pingus_sdl/src/actions/slider.cpp
branches/pingus_sdl/src/actions/slider.hpp
branches/pingus_sdl/src/actions/smashed.cpp
branches/pingus_sdl/src/actions/smashed.hpp
branches/pingus_sdl/src/actions/splashed.cpp
branches/pingus_sdl/src/actions/splashed.hpp
branches/pingus_sdl/src/actions/superman.cpp
branches/pingus_sdl/src/actions/superman.hpp
branches/pingus_sdl/src/actions/teleported.cpp
branches/pingus_sdl/src/actions/teleported.hpp
branches/pingus_sdl/src/actions/waiter.cpp
branches/pingus_sdl/src/actions/waiter.hpp
branches/pingus_sdl/src/actions/walker.cpp
branches/pingus_sdl/src/actions/walker.hpp
branches/pingus_sdl/src/blitter.cpp
branches/pingus_sdl/src/blitter.hpp
branches/pingus_sdl/src/blitter_impl.hpp
branches/pingus_sdl/src/blitter_test.cpp
branches/pingus_sdl/src/blitter_test.hpp
branches/pingus_sdl/src/capture_rectangle.cpp
branches/pingus_sdl/src/capture_rectangle.hpp
branches/pingus_sdl/src/cheat.cpp
branches/pingus_sdl/src/cheat.hpp
branches/pingus_sdl/src/client.cpp
branches/pingus_sdl/src/client.hpp
branches/pingus_sdl/src/col_map.cpp
branches/pingus_sdl/src/col_map.hpp
branches/pingus_sdl/src/collider.cpp
branches/pingus_sdl/src/collider.hpp
branches/pingus_sdl/src/colliders/pingu_collider.cpp
branches/pingus_sdl/src/colliders/pingu_collider.hpp
branches/pingus_sdl/src/components/action_button.cpp
branches/pingus_sdl/src/components/action_button.hpp
branches/pingus_sdl/src/components/button_panel.cpp
branches/pingus_sdl/src/components/button_panel.hpp
branches/pingus_sdl/src/components/hurry_up.cpp
branches/pingus_sdl/src/components/hurry_up.hpp
branches/pingus_sdl/src/components/menu_button.cpp
branches/pingus_sdl/src/components/menu_button.hpp
branches/pingus_sdl/src/components/pingus_counter.cpp
branches/pingus_sdl/src/components/pingus_counter.hpp
branches/pingus_sdl/src/components/playfield.cpp
branches/pingus_sdl/src/components/playfield.hpp
branches/pingus_sdl/src/components/smallmap.cpp
branches/pingus_sdl/src/components/smallmap.hpp
branches/pingus_sdl/src/components/time_display.cpp
branches/pingus_sdl/src/components/time_display.hpp
branches/pingus_sdl/src/config.cpp
branches/pingus_sdl/src/config.hpp
branches/pingus_sdl/src/console.cpp
branches/pingus_sdl/src/console.hpp
branches/pingus_sdl/src/credits.cpp
branches/pingus_sdl/src/credits.hpp
branches/pingus_sdl/src/debug.cpp
branches/pingus_sdl/src/debug.hpp
branches/pingus_sdl/src/debug_stream.cpp
branches/pingus_sdl/src/debug_stream.hpp
branches/pingus_sdl/src/delta_manager.hpp
branches/pingus_sdl/src/demo_player.cpp
branches/pingus_sdl/src/demo_player.hpp
branches/pingus_sdl/src/demo_recorder.cpp
branches/pingus_sdl/src/demo_recorder.hpp
branches/pingus_sdl/src/demo_session.cpp
branches/pingus_sdl/src/demo_session.hpp
branches/pingus_sdl/src/direction.cpp
branches/pingus_sdl/src/direction.hpp
branches/pingus_sdl/src/display/drawing_context.cpp
branches/pingus_sdl/src/display/drawing_context.hpp
branches/pingus_sdl/src/display/drawing_request.hpp
branches/pingus_sdl/src/display/scene_context.cpp
branches/pingus_sdl/src/display/scene_context.hpp
branches/pingus_sdl/src/display/scene_graph.cpp
branches/pingus_sdl/src/display/scene_graph.hpp
branches/pingus_sdl/src/display/scene_group.hpp
branches/pingus_sdl/src/display/scene_node.cpp
branches/pingus_sdl/src/display/scene_node.hpp
branches/pingus_sdl/src/display/scene_test.cpp
branches/pingus_sdl/src/display/sprite_node.cpp
branches/pingus_sdl/src/display/sprite_node.hpp
branches/pingus_sdl/src/dummy_screen.hpp
branches/pingus_sdl/src/editor/context_menu.cpp
branches/pingus_sdl/src/editor/context_menu.hpp
branches/pingus_sdl/src/editor/editor_panel.cpp
branches/pingus_sdl/src/editor/editor_panel.hpp
branches/pingus_sdl/src/editor/editor_screen.cpp
branches/pingus_sdl/src/editor/editor_screen.hpp
branches/pingus_sdl/src/editor/editor_viewport.cpp
branches/pingus_sdl/src/editor/editor_viewport.hpp
branches/pingus_sdl/src/editor/level_head.cpp
branches/pingus_sdl/src/editor/level_head.hpp
branches/pingus_sdl/src/editor/level_impl.hpp
branches/pingus_sdl/src/editor/level_objs.cpp
branches/pingus_sdl/src/editor/level_objs.hpp
branches/pingus_sdl/src/editor/panel_buttons.cpp
branches/pingus_sdl/src/editor/panel_buttons.hpp
branches/pingus_sdl/src/editor/xml_level.cpp
branches/pingus_sdl/src/editor/xml_level.hpp
branches/pingus_sdl/src/exit_menu.cpp
branches/pingus_sdl/src/exit_menu.hpp
branches/pingus_sdl/src/file_dialog.cpp
branches/pingus_sdl/src/file_dialog.hpp
branches/pingus_sdl/src/file_dialog_item.cpp
branches/pingus_sdl/src/file_dialog_item.hpp
branches/pingus_sdl/src/file_dialog_listener.hpp
branches/pingus_sdl/src/file_reader.cpp
branches/pingus_sdl/src/file_reader.hpp
branches/pingus_sdl/src/file_reader_impl.hpp
branches/pingus_sdl/src/file_writer.hpp
branches/pingus_sdl/src/fonts.cpp
branches/pingus_sdl/src/fonts.hpp
branches/pingus_sdl/src/fps_counter.cpp
branches/pingus_sdl/src/fps_counter.hpp
branches/pingus_sdl/src/game_event.hpp
branches/pingus_sdl/src/game_session.cpp
branches/pingus_sdl/src/game_session.hpp
branches/pingus_sdl/src/game_session_result.cpp
branches/pingus_sdl/src/game_session_result.hpp
branches/pingus_sdl/src/game_time.cpp
branches/pingus_sdl/src/game_time.hpp
branches/pingus_sdl/src/gettext.cpp
branches/pingus_sdl/src/global_event.cpp
branches/pingus_sdl/src/global_event.hpp
branches/pingus_sdl/src/globals.cpp
branches/pingus_sdl/src/globals.hpp
branches/pingus_sdl/src/goal_manager.cpp
branches/pingus_sdl/src/goal_manager.hpp
branches/pingus_sdl/src/graphic_context_state.cpp
branches/pingus_sdl/src/graphic_context_state.hpp
branches/pingus_sdl/src/ground_map.cpp
branches/pingus_sdl/src/ground_map.hpp
branches/pingus_sdl/src/groundtype.cpp
branches/pingus_sdl/src/groundtype.hpp
branches/pingus_sdl/src/gui/buffer_graphic_context.cpp
branches/pingus_sdl/src/gui/buffer_graphic_context.hpp
branches/pingus_sdl/src/gui/button.hpp
branches/pingus_sdl/src/gui/checkbox.cpp
branches/pingus_sdl/src/gui/checkbox.hpp
branches/pingus_sdl/src/gui/checkbox_listener.hpp
branches/pingus_sdl/src/gui/combobox.cpp
branches/pingus_sdl/src/gui/combobox.hpp
branches/pingus_sdl/src/gui/combobox_listener.hpp
branches/pingus_sdl/src/gui/component.hpp
branches/pingus_sdl/src/gui/cursor.cpp
branches/pingus_sdl/src/gui/cursor.hpp
branches/pingus_sdl/src/gui/display.cpp
branches/pingus_sdl/src/gui/display.hpp
branches/pingus_sdl/src/gui/game_delta.hpp
branches/pingus_sdl/src/gui/game_delta_recorder.hpp
branches/pingus_sdl/src/gui/gui_manager.cpp
branches/pingus_sdl/src/gui/gui_manager.hpp
branches/pingus_sdl/src/gui/gui_screen.cpp
branches/pingus_sdl/src/gui/gui_screen.hpp
branches/pingus_sdl/src/gui/input_box.cpp
branches/pingus_sdl/src/gui/input_box.hpp
branches/pingus_sdl/src/gui/input_debug_screen.cpp
branches/pingus_sdl/src/gui/input_debug_screen.hpp
branches/pingus_sdl/src/gui/root_gui_manager.cpp
branches/pingus_sdl/src/gui/root_gui_manager.hpp
branches/pingus_sdl/src/gui/screen.cpp
branches/pingus_sdl/src/gui/screen.hpp
branches/pingus_sdl/src/gui/screen_manager.cpp
branches/pingus_sdl/src/gui/screen_manager.hpp
branches/pingus_sdl/src/gui/screen_manager_impl.hpp
branches/pingus_sdl/src/gui/screen_ptr.cpp
branches/pingus_sdl/src/gui/screen_ptr.hpp
branches/pingus_sdl/src/gui/surface_button.cpp
branches/pingus_sdl/src/gui/surface_button.hpp
branches/pingus_sdl/src/indexed_canvas.cpp
branches/pingus_sdl/src/indexed_canvas.hpp
branches/pingus_sdl/src/input/axes/button_axis.cpp
branches/pingus_sdl/src/input/axes/button_axis.hpp
branches/pingus_sdl/src/input/axes/dummy_axis.hpp
branches/pingus_sdl/src/input/axes/inverted_axis.cpp
branches/pingus_sdl/src/input/axes/inverted_axis.hpp
branches/pingus_sdl/src/input/axes/joystick_axis.cpp
branches/pingus_sdl/src/input/axes/joystick_axis.hpp
branches/pingus_sdl/src/input/axes/mouse_axis.cpp
branches/pingus_sdl/src/input/axes/mouse_axis.hpp
branches/pingus_sdl/src/input/axes/multiple_axis.cpp
branches/pingus_sdl/src/input/axes/multiple_axis.hpp
branches/pingus_sdl/src/input/axis.hpp
branches/pingus_sdl/src/input/axis_factory.cpp
branches/pingus_sdl/src/input/axis_factory.hpp
branches/pingus_sdl/src/input/button.hpp
branches/pingus_sdl/src/input/button_factory.cpp
branches/pingus_sdl/src/input/button_factory.hpp
branches/pingus_sdl/src/input/buttons/double_button.cpp
branches/pingus_sdl/src/input/buttons/double_button.hpp
branches/pingus_sdl/src/input/buttons/dummy_button.hpp
branches/pingus_sdl/src/input/buttons/joystick_button.cpp
branches/pingus_sdl/src/input/buttons/joystick_button.hpp
branches/pingus_sdl/src/input/buttons/key_button.cpp
branches/pingus_sdl/src/input/buttons/key_button.hpp
branches/pingus_sdl/src/input/buttons/mouse_button.cpp
branches/pingus_sdl/src/input/buttons/mouse_button.hpp
branches/pingus_sdl/src/input/buttons/multiple_button.cpp
branches/pingus_sdl/src/input/buttons/multiple_button.hpp
branches/pingus_sdl/src/input/buttons/triple_button.cpp
branches/pingus_sdl/src/input/buttons/triple_button.hpp
branches/pingus_sdl/src/input/controller.cpp
branches/pingus_sdl/src/input/controller.hpp
branches/pingus_sdl/src/input/event.hpp
branches/pingus_sdl/src/input/event_fwd.hpp
branches/pingus_sdl/src/input/pointer.hpp
branches/pingus_sdl/src/input/pointer_factory.cpp
branches/pingus_sdl/src/input/pointer_factory.hpp
branches/pingus_sdl/src/input/pointers/axis_pointer.cpp
branches/pingus_sdl/src/input/pointers/axis_pointer.hpp
branches/pingus_sdl/src/input/pointers/dummy_pointer.hpp
branches/pingus_sdl/src/input/pointers/mouse_pointer.cpp
branches/pingus_sdl/src/input/pointers/mouse_pointer.hpp
branches/pingus_sdl/src/input/pointers/multiple_pointer.cpp
branches/pingus_sdl/src/input/pointers/multiple_pointer.hpp
branches/pingus_sdl/src/input/scroller.hpp
branches/pingus_sdl/src/input/scroller_factory.cpp
branches/pingus_sdl/src/input/scroller_factory.hpp
branches/pingus_sdl/src/input/scrollers/axis_scroller.cpp
branches/pingus_sdl/src/input/scrollers/axis_scroller.hpp
branches/pingus_sdl/src/input/scrollers/dummy_scroller.hpp
branches/pingus_sdl/src/input/scrollers/inverted_scroller.cpp
branches/pingus_sdl/src/input/scrollers/inverted_scroller.hpp
branches/pingus_sdl/src/input/scrollers/joystick_scroller.cpp
branches/pingus_sdl/src/input/scrollers/joystick_scroller.hpp
branches/pingus_sdl/src/input/scrollers/mouse_scroller.cpp
branches/pingus_sdl/src/input/scrollers/mouse_scroller.hpp
branches/pingus_sdl/src/input/scrollers/multiple_scroller.cpp
branches/pingus_sdl/src/input/scrollers/multiple_scroller.hpp
branches/pingus_sdl/src/input/scrollers/pointer_scroller.cpp
branches/pingus_sdl/src/input/scrollers/pointer_scroller.hpp
branches/pingus_sdl/src/input_event.hpp
branches/pingus_sdl/src/layer_manager.cpp
branches/pingus_sdl/src/layer_manager.hpp
branches/pingus_sdl/src/math.hpp
branches/pingus_sdl/src/mover.cpp
branches/pingus_sdl/src/mover.hpp
branches/pingus_sdl/src/movers/linear_mover.cpp
branches/pingus_sdl/src/movers/linear_mover.hpp
branches/pingus_sdl/src/multiline_text.cpp
branches/pingus_sdl/src/multiline_text.hpp
branches/pingus_sdl/src/particles/explosive_particle.cpp
branches/pingus_sdl/src/particles/explosive_particle.hpp
branches/pingus_sdl/src/particles/ground_particle.cpp
branches/pingus_sdl/src/particles/ground_particle.hpp
branches/pingus_sdl/src/particles/pingu_particle_holder.cpp
branches/pingus_sdl/src/particles/pingu_particle_holder.hpp
branches/pingus_sdl/src/particles/rain_particle_holder.cpp
branches/pingus_sdl/src/particles/rain_particle_holder.hpp
branches/pingus_sdl/src/particles/smoke_particle_holder.cpp
branches/pingus_sdl/src/particles/smoke_particle_holder.hpp
branches/pingus_sdl/src/particles/snow_particle_holder.cpp
branches/pingus_sdl/src/particles/snow_particle_holder.hpp
branches/pingus_sdl/src/path_manager.cpp
branches/pingus_sdl/src/path_manager.hpp
branches/pingus_sdl/src/pingu.cpp
branches/pingus_sdl/src/pingu.hpp
branches/pingus_sdl/src/pingu_action.cpp
branches/pingus_sdl/src/pingu_action.hpp
branches/pingus_sdl/src/pingu_action_factory.cpp
branches/pingus_sdl/src/pingu_action_factory.hpp
branches/pingus_sdl/src/pingu_enums.cpp
branches/pingus_sdl/src/pingu_enums.hpp
branches/pingus_sdl/src/pingu_holder.cpp
branches/pingus_sdl/src/pingu_holder.hpp
branches/pingus_sdl/src/pingus.hpp
branches/pingus_sdl/src/pingus_error.cpp
branches/pingus_sdl/src/pingus_error.hpp
branches/pingus_sdl/src/pingus_level.cpp
branches/pingus_sdl/src/pingus_level.hpp
branches/pingus_sdl/src/pingus_level_impl.hpp
branches/pingus_sdl/src/pingus_level_test.cpp
branches/pingus_sdl/src/pingus_main.cpp
branches/pingus_sdl/src/pingus_main.hpp
branches/pingus_sdl/src/pingus_menu.cpp
branches/pingus_sdl/src/pingus_menu.hpp
branches/pingus_sdl/src/pingus_menu_manager.cpp
branches/pingus_sdl/src/pingus_menu_manager.hpp
branches/pingus_sdl/src/pingus_sub_menu.cpp
branches/pingus_sdl/src/pingus_sub_menu.hpp
branches/pingus_sdl/src/plf_res_mgr.cpp
branches/pingus_sdl/src/plf_res_mgr.hpp
branches/pingus_sdl/src/plt_xml.cpp
branches/pingus_sdl/src/plt_xml.hpp
branches/pingus_sdl/src/preview_renderer.cpp
branches/pingus_sdl/src/preview_renderer.hpp
branches/pingus_sdl/src/res_descriptor.cpp
branches/pingus_sdl/src/res_descriptor.hpp
branches/pingus_sdl/src/resource.cpp
branches/pingus_sdl/src/resource.hpp
branches/pingus_sdl/src/resource_modifier.cpp
branches/pingus_sdl/src/resource_modifier.hpp
branches/pingus_sdl/src/result.hpp
branches/pingus_sdl/src/result_screen.cpp
branches/pingus_sdl/src/result_screen.hpp
branches/pingus_sdl/src/savegame.cpp
branches/pingus_sdl/src/savegame.hpp
branches/pingus_sdl/src/savegame_manager.cpp
branches/pingus_sdl/src/savegame_manager.hpp
branches/pingus_sdl/src/screenshot.cpp
branches/pingus_sdl/src/screenshot.hpp
branches/pingus_sdl/src/server.cpp
branches/pingus_sdl/src/server.hpp
branches/pingus_sdl/src/server_event.cpp
branches/pingus_sdl/src/server_event.hpp
branches/pingus_sdl/src/sexpr_pingus_level.cpp
branches/pingus_sdl/src/sexpr_pingus_level.hpp
branches/pingus_sdl/src/shared_ptr.hpp
branches/pingus_sdl/src/smallmap_image.cpp
branches/pingus_sdl/src/smallmap_image.hpp
branches/pingus_sdl/src/sound/slot_manager.cpp
branches/pingus_sdl/src/sound/slot_manager.hpp
branches/pingus_sdl/src/sound/sound.cpp
branches/pingus_sdl/src/sound/sound.hpp
branches/pingus_sdl/src/sound/sound_dummy.cpp
branches/pingus_sdl/src/sound/sound_dummy.hpp
branches/pingus_sdl/src/sound/sound_impl.hpp
branches/pingus_sdl/src/sound/sound_real.cpp
branches/pingus_sdl/src/sound/sound_real.hpp
branches/pingus_sdl/src/sound/sound_res_mgr.cpp
branches/pingus_sdl/src/sound/sound_res_mgr.hpp
branches/pingus_sdl/src/sound/sounds.hpp
branches/pingus_sdl/src/start_screen.cpp
branches/pingus_sdl/src/start_screen.hpp
branches/pingus_sdl/src/stat_manager.cpp
branches/pingus_sdl/src/stat_manager.hpp
branches/pingus_sdl/src/state_sprite.cpp
branches/pingus_sdl/src/state_sprite.hpp
branches/pingus_sdl/src/story_screen.cpp
branches/pingus_sdl/src/story_screen.hpp
branches/pingus_sdl/src/string_format.cpp
branches/pingus_sdl/src/string_format.hpp
branches/pingus_sdl/src/system.cpp
branches/pingus_sdl/src/system.hpp
branches/pingus_sdl/src/target_provider.cpp
branches/pingus_sdl/src/target_provider.hpp
branches/pingus_sdl/src/theme.cpp
branches/pingus_sdl/src/theme.hpp
branches/pingus_sdl/src/theme_selector.cpp
branches/pingus_sdl/src/theme_selector.hpp
branches/pingus_sdl/src/timer.cpp
branches/pingus_sdl/src/timer.hpp
branches/pingus_sdl/src/tinygettext/tinygettext.cpp
branches/pingus_sdl/src/tinygettext/tinygettext.hpp
branches/pingus_sdl/src/true_server.cpp
branches/pingus_sdl/src/true_server.hpp
branches/pingus_sdl/src/world.cpp
branches/pingus_sdl/src/world.hpp
branches/pingus_sdl/src/worldmap/dot.cpp
branches/pingus_sdl/src/worldmap/dot.hpp
branches/pingus_sdl/src/worldmap/dot_factory.cpp
branches/pingus_sdl/src/worldmap/dot_factory.hpp
branches/pingus_sdl/src/worldmap/drawable.cpp
branches/pingus_sdl/src/worldmap/drawable.hpp
branches/pingus_sdl/src/worldmap/drawable_factory.cpp
branches/pingus_sdl/src/worldmap/drawable_factory.hpp
branches/pingus_sdl/src/worldmap/graph.cpp
branches/pingus_sdl/src/worldmap/graph.hpp
branches/pingus_sdl/src/worldmap/level_dot.cpp
branches/pingus_sdl/src/worldmap/level_dot.hpp
branches/pingus_sdl/src/worldmap/manager.cpp
branches/pingus_sdl/src/worldmap/manager.hpp
branches/pingus_sdl/src/worldmap/metamap.cpp
branches/pingus_sdl/src/worldmap/metamap.hpp
branches/pingus_sdl/src/worldmap/path.cpp
branches/pingus_sdl/src/worldmap/path.hpp
branches/pingus_sdl/src/worldmap/path_drawable.cpp
branches/pingus_sdl/src/worldmap/path_drawable.hpp
branches/pingus_sdl/src/worldmap/path_graph.cpp
branches/pingus_sdl/src/worldmap/path_graph.hpp
branches/pingus_sdl/src/worldmap/pathfinder.hpp
branches/pingus_sdl/src/worldmap/pingus.cpp
branches/pingus_sdl/src/worldmap/pingus.hpp
branches/pingus_sdl/src/worldmap/sprite_drawable.cpp
branches/pingus_sdl/src/worldmap/sprite_drawable.hpp
branches/pingus_sdl/src/worldmap/surface_drawable.cpp
branches/pingus_sdl/src/worldmap/surface_drawable.hpp
branches/pingus_sdl/src/worldmap/world_dot.cpp
branches/pingus_sdl/src/worldmap/world_dot.hpp
branches/pingus_sdl/src/worldmap/worldmap.cpp
branches/pingus_sdl/src/worldmap/worldmap.hpp
branches/pingus_sdl/src/worldmap/worldmap_story.cpp
branches/pingus_sdl/src/worldmap/worldmap_story.hpp
branches/pingus_sdl/src/worldobj.cpp
branches/pingus_sdl/src/worldobj.hpp
branches/pingus_sdl/src/worldobj_factory.cpp
branches/pingus_sdl/src/worldobj_factory.hpp
branches/pingus_sdl/src/worldobjs/conveyor_belt.cpp
branches/pingus_sdl/src/worldobjs/conveyor_belt.hpp
branches/pingus_sdl/src/worldobjs/entrance.cpp
branches/pingus_sdl/src/worldobjs/entrance.hpp
branches/pingus_sdl/src/worldobjs/exit.cpp
branches/pingus_sdl/src/worldobjs/exit.hpp
branches/pingus_sdl/src/worldobjs/fake_exit.cpp
branches/pingus_sdl/src/worldobjs/fake_exit.hpp
branches/pingus_sdl/src/worldobjs/groundpiece.cpp
branches/pingus_sdl/src/worldobjs/groundpiece.hpp
branches/pingus_sdl/src/worldobjs/guillotine.cpp
branches/pingus_sdl/src/worldobjs/guillotine.hpp
branches/pingus_sdl/src/worldobjs/hammer.cpp
branches/pingus_sdl/src/worldobjs/hammer.hpp
branches/pingus_sdl/src/worldobjs/hotspot.cpp
branches/pingus_sdl/src/worldobjs/hotspot.hpp
branches/pingus_sdl/src/worldobjs/ice_block.cpp
branches/pingus_sdl/src/worldobjs/ice_block.hpp
branches/pingus_sdl/src/worldobjs/info_box.cpp
branches/pingus_sdl/src/worldobjs/info_box.hpp
branches/pingus_sdl/src/worldobjs/laser_exit.cpp
branches/pingus_sdl/src/worldobjs/laser_exit.hpp
branches/pingus_sdl/src/worldobjs/liquid.cpp
branches/pingus_sdl/src/worldobjs/liquid.hpp
branches/pingus_sdl/src/worldobjs/rain_generator.cpp
branches/pingus_sdl/src/worldobjs/rain_generator.hpp
branches/pingus_sdl/src/worldobjs/smasher.cpp
branches/pingus_sdl/src/worldobjs/smasher.hpp
branches/pingus_sdl/src/worldobjs/snow_generator.cpp
branches/pingus_sdl/src/worldobjs/snow_generator.hpp
branches/pingus_sdl/src/worldobjs/solid_color_background.cpp
branches/pingus_sdl/src/worldobjs/solid_color_background.hpp
branches/pingus_sdl/src/worldobjs/spike.cpp
branches/pingus_sdl/src/worldobjs/spike.hpp
branches/pingus_sdl/src/worldobjs/starfield_background.cpp
branches/pingus_sdl/src/worldobjs/starfield_background.hpp
branches/pingus_sdl/src/worldobjs/starfield_background_stars.cpp
branches/pingus_sdl/src/worldobjs/starfield_background_stars.hpp
branches/pingus_sdl/src/worldobjs/surface_background.cpp
branches/pingus_sdl/src/worldobjs/surface_background.hpp
branches/pingus_sdl/src/worldobjs/switch_door.cpp
branches/pingus_sdl/src/worldobjs/switch_door.hpp
branches/pingus_sdl/src/worldobjs/teleporter.cpp
branches/pingus_sdl/src/worldobjs/teleporter.hpp
branches/pingus_sdl/src/worldobjs/thunderstorm_background.cpp
branches/pingus_sdl/src/worldobjs/thunderstorm_background.hpp
branches/pingus_sdl/src/worldobjs/woodthing.cpp
branches/pingus_sdl/src/worldobjs/woodthing.hpp
branches/pingus_sdl/src/xml_eval.cpp
branches/pingus_sdl/src/xml_eval.hpp
branches/pingus_sdl/src/xml_file_reader.cpp
branches/pingus_sdl/src/xml_file_reader.hpp
branches/pingus_sdl/src/xml_file_writer.cpp
branches/pingus_sdl/src/xml_file_writer.hpp
branches/pingus_sdl/src/xml_pdf.cpp
branches/pingus_sdl/src/xml_pdf.hpp
branches/pingus_sdl/src/xml_pingus_level.cpp
branches/pingus_sdl/src/xml_pingus_level.hpp
Removed:
branches/pingus_sdl/src/action_holder.cxx
branches/pingus_sdl/src/action_holder.hxx
branches/pingus_sdl/src/actions/angel.cxx
branches/pingus_sdl/src/actions/angel.hxx
branches/pingus_sdl/src/actions/basher.cxx
branches/pingus_sdl/src/actions/basher.hxx
branches/pingus_sdl/src/actions/blocker.cxx
branches/pingus_sdl/src/actions/blocker.hxx
branches/pingus_sdl/src/actions/boarder.cxx
branches/pingus_sdl/src/actions/boarder.hxx
branches/pingus_sdl/src/actions/bomber.cxx
branches/pingus_sdl/src/actions/bomber.hxx
branches/pingus_sdl/src/actions/bridger.cxx
branches/pingus_sdl/src/actions/bridger.hxx
branches/pingus_sdl/src/actions/climber.cxx
branches/pingus_sdl/src/actions/climber.hxx
branches/pingus_sdl/src/actions/digger.cxx
branches/pingus_sdl/src/actions/digger.hxx
branches/pingus_sdl/src/actions/drown.cxx
branches/pingus_sdl/src/actions/drown.hxx
branches/pingus_sdl/src/actions/exiter.cxx
branches/pingus_sdl/src/actions/exiter.hxx
branches/pingus_sdl/src/actions/faller.cxx
branches/pingus_sdl/src/actions/faller.hxx
branches/pingus_sdl/src/actions/floater.cxx
branches/pingus_sdl/src/actions/floater.hxx
branches/pingus_sdl/src/actions/jumper.cxx
branches/pingus_sdl/src/actions/jumper.hxx
branches/pingus_sdl/src/actions/laser_kill.cxx
branches/pingus_sdl/src/actions/laser_kill.hxx
branches/pingus_sdl/src/actions/miner.cxx
branches/pingus_sdl/src/actions/miner.hxx
branches/pingus_sdl/src/actions/rocket_launcher.cxx
branches/pingus_sdl/src/actions/rocket_launcher.hxx
branches/pingus_sdl/src/actions/slider.cxx
branches/pingus_sdl/src/actions/slider.hxx
branches/pingus_sdl/src/actions/smashed.cxx
branches/pingus_sdl/src/actions/smashed.hxx
branches/pingus_sdl/src/actions/splashed.cxx
branches/pingus_sdl/src/actions/splashed.hxx
branches/pingus_sdl/src/actions/superman.cxx
branches/pingus_sdl/src/actions/superman.hxx
branches/pingus_sdl/src/actions/teleported.cxx
branches/pingus_sdl/src/actions/teleported.hxx
branches/pingus_sdl/src/actions/waiter.cxx
branches/pingus_sdl/src/actions/waiter.hxx
branches/pingus_sdl/src/actions/walker.cxx
branches/pingus_sdl/src/actions/walker.hxx
branches/pingus_sdl/src/blitter.cxx
branches/pingus_sdl/src/blitter.hxx
branches/pingus_sdl/src/blitter_impl.hxx
branches/pingus_sdl/src/blitter_test.cxx
branches/pingus_sdl/src/blitter_test.hxx
branches/pingus_sdl/src/capture_rectangle.cxx
branches/pingus_sdl/src/capture_rectangle.hxx
branches/pingus_sdl/src/cheat.cxx
branches/pingus_sdl/src/cheat.hxx
branches/pingus_sdl/src/client.cxx
branches/pingus_sdl/src/client.hxx
branches/pingus_sdl/src/col_map.cxx
branches/pingus_sdl/src/col_map.hxx
branches/pingus_sdl/src/collider.cxx
branches/pingus_sdl/src/collider.hxx
branches/pingus_sdl/src/colliders/pingu_collider.cxx
branches/pingus_sdl/src/colliders/pingu_collider.hxx
branches/pingus_sdl/src/components/action_button.cxx
branches/pingus_sdl/src/components/action_button.hxx
branches/pingus_sdl/src/components/button_panel.cxx
branches/pingus_sdl/src/components/button_panel.hxx
branches/pingus_sdl/src/components/hurry_up.cxx
branches/pingus_sdl/src/components/hurry_up.hxx
branches/pingus_sdl/src/components/menu_button.cxx
branches/pingus_sdl/src/components/menu_button.hxx
branches/pingus_sdl/src/components/pingus_counter.cxx
branches/pingus_sdl/src/components/pingus_counter.hxx
branches/pingus_sdl/src/components/playfield.cxx
branches/pingus_sdl/src/components/playfield.hxx
branches/pingus_sdl/src/components/smallmap.cxx
branches/pingus_sdl/src/components/smallmap.hxx
branches/pingus_sdl/src/components/time_display.cxx
branches/pingus_sdl/src/components/time_display.hxx
branches/pingus_sdl/src/config.cxx
branches/pingus_sdl/src/config.hxx
branches/pingus_sdl/src/console.cxx
branches/pingus_sdl/src/console.hxx
branches/pingus_sdl/src/credits.cxx
branches/pingus_sdl/src/credits.hxx
branches/pingus_sdl/src/debug.cxx
branches/pingus_sdl/src/debug.hxx
branches/pingus_sdl/src/debug_stream.cxx
branches/pingus_sdl/src/debug_stream.hxx
branches/pingus_sdl/src/delta_manager.hxx
branches/pingus_sdl/src/demo_player.cxx
branches/pingus_sdl/src/demo_player.hxx
branches/pingus_sdl/src/demo_recorder.cxx
branches/pingus_sdl/src/demo_recorder.hxx
branches/pingus_sdl/src/demo_session.cxx
branches/pingus_sdl/src/demo_session.hxx
branches/pingus_sdl/src/direction.cxx
branches/pingus_sdl/src/direction.hxx
branches/pingus_sdl/src/display/drawing_context.cxx
branches/pingus_sdl/src/display/drawing_context.hxx
branches/pingus_sdl/src/display/drawing_request.hxx
branches/pingus_sdl/src/display/scene_context.cxx
branches/pingus_sdl/src/display/scene_context.hxx
branches/pingus_sdl/src/display/scene_graph.cxx
branches/pingus_sdl/src/display/scene_graph.hxx
branches/pingus_sdl/src/display/scene_group.hxx
branches/pingus_sdl/src/display/scene_node.cxx
branches/pingus_sdl/src/display/scene_node.hxx
branches/pingus_sdl/src/display/scene_test.cxx
branches/pingus_sdl/src/display/sprite_node.cxx
branches/pingus_sdl/src/display/sprite_node.hxx
branches/pingus_sdl/src/dummy_screen.hxx
branches/pingus_sdl/src/editor/context_menu.cxx
branches/pingus_sdl/src/editor/context_menu.hxx
branches/pingus_sdl/src/editor/editor_panel.cxx
branches/pingus_sdl/src/editor/editor_panel.hxx
branches/pingus_sdl/src/editor/editor_screen.cxx
branches/pingus_sdl/src/editor/editor_screen.hxx
branches/pingus_sdl/src/editor/editor_viewport.cxx
branches/pingus_sdl/src/editor/editor_viewport.hxx
branches/pingus_sdl/src/editor/level_head.cxx
branches/pingus_sdl/src/editor/level_head.hxx
branches/pingus_sdl/src/editor/level_impl.hxx
branches/pingus_sdl/src/editor/level_objs.cxx
branches/pingus_sdl/src/editor/level_objs.hxx
branches/pingus_sdl/src/editor/panel_buttons.cxx
branches/pingus_sdl/src/editor/panel_buttons.hxx
branches/pingus_sdl/src/editor/xml_level.cxx
branches/pingus_sdl/src/editor/xml_level.hxx
branches/pingus_sdl/src/exit_menu.cxx
branches/pingus_sdl/src/exit_menu.hxx
branches/pingus_sdl/src/file_dialog.cxx
branches/pingus_sdl/src/file_dialog.hxx
branches/pingus_sdl/src/file_dialog_item.cxx
branches/pingus_sdl/src/file_dialog_item.hxx
branches/pingus_sdl/src/file_dialog_listener.hxx
branches/pingus_sdl/src/file_reader.cxx
branches/pingus_sdl/src/file_reader.hxx
branches/pingus_sdl/src/file_reader_impl.hxx
branches/pingus_sdl/src/file_writer.hxx
branches/pingus_sdl/src/fonts.cxx
branches/pingus_sdl/src/fonts.hxx
branches/pingus_sdl/src/fps_counter.cxx
branches/pingus_sdl/src/fps_counter.hxx
branches/pingus_sdl/src/game_event.hxx
branches/pingus_sdl/src/game_session.cxx
branches/pingus_sdl/src/game_session.hxx
branches/pingus_sdl/src/game_session_result.cxx
branches/pingus_sdl/src/game_session_result.hxx
branches/pingus_sdl/src/game_time.cxx
branches/pingus_sdl/src/game_time.hxx
branches/pingus_sdl/src/gettext.cxx
branches/pingus_sdl/src/global_event.cxx
branches/pingus_sdl/src/global_event.hxx
branches/pingus_sdl/src/globals.cxx
branches/pingus_sdl/src/globals.hxx
branches/pingus_sdl/src/goal_manager.cxx
branches/pingus_sdl/src/goal_manager.hxx
branches/pingus_sdl/src/graphic_context_state.cxx
branches/pingus_sdl/src/graphic_context_state.hxx
branches/pingus_sdl/src/ground_map.cxx
branches/pingus_sdl/src/ground_map.hxx
branches/pingus_sdl/src/groundtype.cxx
branches/pingus_sdl/src/groundtype.hxx
branches/pingus_sdl/src/gui/buffer_graphic_context.cxx
branches/pingus_sdl/src/gui/buffer_graphic_context.hxx
branches/pingus_sdl/src/gui/button.hxx
branches/pingus_sdl/src/gui/checkbox.cxx
branches/pingus_sdl/src/gui/checkbox.hxx
branches/pingus_sdl/src/gui/checkbox_listener.hxx
branches/pingus_sdl/src/gui/combobox.cxx
branches/pingus_sdl/src/gui/combobox.hxx
branches/pingus_sdl/src/gui/combobox_listener.hxx
branches/pingus_sdl/src/gui/component.hxx
branches/pingus_sdl/src/gui/cursor.cxx
branches/pingus_sdl/src/gui/cursor.hxx
branches/pingus_sdl/src/gui/display.cxx
branches/pingus_sdl/src/gui/display.hxx
branches/pingus_sdl/src/gui/game_delta.hxx
branches/pingus_sdl/src/gui/game_delta_recorder.hxx
branches/pingus_sdl/src/gui/gui_manager.cxx
branches/pingus_sdl/src/gui/gui_manager.hxx
branches/pingus_sdl/src/gui/gui_screen.cxx
branches/pingus_sdl/src/gui/gui_screen.hxx
branches/pingus_sdl/src/gui/input_box.cxx
branches/pingus_sdl/src/gui/input_box.hxx
branches/pingus_sdl/src/gui/input_debug_screen.cxx
branches/pingus_sdl/src/gui/input_debug_screen.hxx
branches/pingus_sdl/src/gui/root_gui_manager.cxx
branches/pingus_sdl/src/gui/root_gui_manager.hxx
branches/pingus_sdl/src/gui/screen.cxx
branches/pingus_sdl/src/gui/screen.hxx
branches/pingus_sdl/src/gui/screen_manager.cxx
branches/pingus_sdl/src/gui/screen_manager.hxx
branches/pingus_sdl/src/gui/screen_manager_impl.hxx
branches/pingus_sdl/src/gui/screen_ptr.cxx
branches/pingus_sdl/src/gui/screen_ptr.hxx
branches/pingus_sdl/src/gui/surface_button.cxx
branches/pingus_sdl/src/gui/surface_button.hxx
branches/pingus_sdl/src/indexed_canvas.cxx
branches/pingus_sdl/src/indexed_canvas.hxx
branches/pingus_sdl/src/input/axes/button_axis.cxx
branches/pingus_sdl/src/input/axes/button_axis.hxx
branches/pingus_sdl/src/input/axes/dummy_axis.hxx
branches/pingus_sdl/src/input/axes/inverted_axis.cxx
branches/pingus_sdl/src/input/axes/inverted_axis.hxx
branches/pingus_sdl/src/input/axes/joystick_axis.cxx
branches/pingus_sdl/src/input/axes/joystick_axis.hxx
branches/pingus_sdl/src/input/axes/mouse_axis.cxx
branches/pingus_sdl/src/input/axes/mouse_axis.hxx
branches/pingus_sdl/src/input/axes/multiple_axis.cxx
branches/pingus_sdl/src/input/axes/multiple_axis.hxx
branches/pingus_sdl/src/input/axis.hxx
branches/pingus_sdl/src/input/axis_factory.cxx
branches/pingus_sdl/src/input/axis_factory.hxx
branches/pingus_sdl/src/input/button.hxx
branches/pingus_sdl/src/input/button_factory.cxx
branches/pingus_sdl/src/input/button_factory.hxx
branches/pingus_sdl/src/input/buttons/double_button.cxx
branches/pingus_sdl/src/input/buttons/double_button.hxx
branches/pingus_sdl/src/input/buttons/dummy_button.hxx
branches/pingus_sdl/src/input/buttons/joystick_button.cxx
branches/pingus_sdl/src/input/buttons/joystick_button.hxx
branches/pingus_sdl/src/input/buttons/key_button.cxx
branches/pingus_sdl/src/input/buttons/key_button.hxx
branches/pingus_sdl/src/input/buttons/mouse_button.cxx
branches/pingus_sdl/src/input/buttons/mouse_button.hxx
branches/pingus_sdl/src/input/buttons/multiple_button.cxx
branches/pingus_sdl/src/input/buttons/multiple_button.hxx
branches/pingus_sdl/src/input/buttons/triple_button.cxx
branches/pingus_sdl/src/input/buttons/triple_button.hxx
branches/pingus_sdl/src/input/controller.cxx
branches/pingus_sdl/src/input/controller.hxx
branches/pingus_sdl/src/input/event.hxx
branches/pingus_sdl/src/input/event_fwd.hxx
branches/pingus_sdl/src/input/pointer.hxx
branches/pingus_sdl/src/input/pointer_factory.cxx
branches/pingus_sdl/src/input/pointer_factory.hxx
branches/pingus_sdl/src/input/pointers/axis_pointer.cxx
branches/pingus_sdl/src/input/pointers/axis_pointer.hxx
branches/pingus_sdl/src/input/pointers/dummy_pointer.hxx
branches/pingus_sdl/src/input/pointers/mouse_pointer.cxx
branches/pingus_sdl/src/input/pointers/mouse_pointer.hxx
branches/pingus_sdl/src/input/pointers/multiple_pointer.cxx
branches/pingus_sdl/src/input/pointers/multiple_pointer.hxx
branches/pingus_sdl/src/input/scroller.hxx
branches/pingus_sdl/src/input/scroller_factory.cxx
branches/pingus_sdl/src/input/scroller_factory.hxx
branches/pingus_sdl/src/input/scrollers/axis_scroller.cxx
branches/pingus_sdl/src/input/scrollers/axis_scroller.hxx
branches/pingus_sdl/src/input/scrollers/dummy_scroller.hxx
branches/pingus_sdl/src/input/scrollers/inverted_scroller.cxx
branches/pingus_sdl/src/input/scrollers/inverted_scroller.hxx
branches/pingus_sdl/src/input/scrollers/joystick_scroller.cxx
branches/pingus_sdl/src/input/scrollers/joystick_scroller.hxx
branches/pingus_sdl/src/input/scrollers/mouse_scroller.cxx
branches/pingus_sdl/src/input/scrollers/mouse_scroller.hxx
branches/pingus_sdl/src/input/scrollers/multiple_scroller.cxx
branches/pingus_sdl/src/input/scrollers/multiple_scroller.hxx
branches/pingus_sdl/src/input/scrollers/pointer_scroller.cxx
branches/pingus_sdl/src/input/scrollers/pointer_scroller.hxx
branches/pingus_sdl/src/input_event.hxx
branches/pingus_sdl/src/layer_manager.cxx
branches/pingus_sdl/src/layer_manager.hxx
branches/pingus_sdl/src/math.hxx
branches/pingus_sdl/src/mover.cxx
branches/pingus_sdl/src/mover.hxx
branches/pingus_sdl/src/movers/linear_mover.cxx
branches/pingus_sdl/src/movers/linear_mover.hxx
branches/pingus_sdl/src/multiline_text.cxx
branches/pingus_sdl/src/multiline_text.hxx
branches/pingus_sdl/src/particles/explosive_particle.cxx
branches/pingus_sdl/src/particles/explosive_particle.hxx
branches/pingus_sdl/src/particles/ground_particle.cxx
branches/pingus_sdl/src/particles/ground_particle.hxx
branches/pingus_sdl/src/particles/pingu_particle_holder.cxx
branches/pingus_sdl/src/particles/pingu_particle_holder.hxx
branches/pingus_sdl/src/particles/rain_particle_holder.cxx
branches/pingus_sdl/src/particles/rain_particle_holder.hxx
branches/pingus_sdl/src/particles/smoke_particle_holder.cxx
branches/pingus_sdl/src/particles/smoke_particle_holder.hxx
branches/pingus_sdl/src/particles/snow_particle_holder.cxx
branches/pingus_sdl/src/particles/snow_particle_holder.hxx
branches/pingus_sdl/src/path_manager.cxx
branches/pingus_sdl/src/path_manager.hxx
branches/pingus_sdl/src/pingu.cxx
branches/pingus_sdl/src/pingu.hxx
branches/pingus_sdl/src/pingu_action.cxx
branches/pingus_sdl/src/pingu_action.hxx
branches/pingus_sdl/src/pingu_action_factory.cxx
branches/pingus_sdl/src/pingu_action_factory.hxx
branches/pingus_sdl/src/pingu_enums.cxx
branches/pingus_sdl/src/pingu_enums.hxx
branches/pingus_sdl/src/pingu_holder.cxx
branches/pingus_sdl/src/pingu_holder.hxx
branches/pingus_sdl/src/pingus.hxx
branches/pingus_sdl/src/pingus_error.cxx
branches/pingus_sdl/src/pingus_error.hxx
branches/pingus_sdl/src/pingus_level.cxx
branches/pingus_sdl/src/pingus_level.hxx
branches/pingus_sdl/src/pingus_level_impl.hxx
branches/pingus_sdl/src/pingus_level_test.cxx
branches/pingus_sdl/src/pingus_main.cxx
branches/pingus_sdl/src/pingus_main.hxx
branches/pingus_sdl/src/pingus_menu.cxx
branches/pingus_sdl/src/pingus_menu.hxx
branches/pingus_sdl/src/pingus_menu_manager.cxx
branches/pingus_sdl/src/pingus_menu_manager.hxx
branches/pingus_sdl/src/pingus_sub_menu.cxx
branches/pingus_sdl/src/pingus_sub_menu.hxx
branches/pingus_sdl/src/plf_res_mgr.cxx
branches/pingus_sdl/src/plf_res_mgr.hxx
branches/pingus_sdl/src/plt_xml.cxx
branches/pingus_sdl/src/plt_xml.hxx
branches/pingus_sdl/src/preview_renderer.cxx
branches/pingus_sdl/src/preview_renderer.hxx
branches/pingus_sdl/src/res_descriptor.cxx
branches/pingus_sdl/src/res_descriptor.hxx
branches/pingus_sdl/src/resource.cxx
branches/pingus_sdl/src/resource.hxx
branches/pingus_sdl/src/resource_modifier.cxx
branches/pingus_sdl/src/resource_modifier.hxx
branches/pingus_sdl/src/result.hxx
branches/pingus_sdl/src/result_screen.cxx
branches/pingus_sdl/src/result_screen.hxx
branches/pingus_sdl/src/savegame.cxx
branches/pingus_sdl/src/savegame.hxx
branches/pingus_sdl/src/savegame_manager.cxx
branches/pingus_sdl/src/savegame_manager.hxx
branches/pingus_sdl/src/screenshot.cxx
branches/pingus_sdl/src/screenshot.hxx
branches/pingus_sdl/src/server.cxx
branches/pingus_sdl/src/server.hxx
branches/pingus_sdl/src/server_event.cxx
branches/pingus_sdl/src/server_event.hxx
branches/pingus_sdl/src/sexpr_pingus_level.cxx
branches/pingus_sdl/src/sexpr_pingus_level.hxx
branches/pingus_sdl/src/shared_ptr.hxx
branches/pingus_sdl/src/smallmap_image.cxx
branches/pingus_sdl/src/smallmap_image.hxx
branches/pingus_sdl/src/sound/slot_manager.cxx
branches/pingus_sdl/src/sound/slot_manager.hxx
branches/pingus_sdl/src/sound/sound.cxx
branches/pingus_sdl/src/sound/sound.hxx
branches/pingus_sdl/src/sound/sound_dummy.cxx
branches/pingus_sdl/src/sound/sound_dummy.hxx
branches/pingus_sdl/src/sound/sound_impl.hxx
branches/pingus_sdl/src/sound/sound_real.cxx
branches/pingus_sdl/src/sound/sound_real.hxx
branches/pingus_sdl/src/sound/sound_res_mgr.cxx
branches/pingus_sdl/src/sound/sound_res_mgr.hxx
branches/pingus_sdl/src/sound/sounds.hxx
branches/pingus_sdl/src/start_screen.cxx
branches/pingus_sdl/src/start_screen.hxx
branches/pingus_sdl/src/stat_manager.cxx
branches/pingus_sdl/src/stat_manager.hxx
branches/pingus_sdl/src/state_sprite.cxx
branches/pingus_sdl/src/state_sprite.hxx
branches/pingus_sdl/src/story_screen.cxx
branches/pingus_sdl/src/story_screen.hxx
branches/pingus_sdl/src/string_format.cxx
branches/pingus_sdl/src/string_format.hxx
branches/pingus_sdl/src/system.cxx
branches/pingus_sdl/src/system.hxx
branches/pingus_sdl/src/target_provider.cxx
branches/pingus_sdl/src/target_provider.hxx
branches/pingus_sdl/src/theme.cxx
branches/pingus_sdl/src/theme.hxx
branches/pingus_sdl/src/theme_selector.cxx
branches/pingus_sdl/src/theme_selector.hxx
branches/pingus_sdl/src/timer.cxx
branches/pingus_sdl/src/timer.hxx
branches/pingus_sdl/src/tinygettext/tinygettext.cxx
branches/pingus_sdl/src/tinygettext/tinygettext.hxx
branches/pingus_sdl/src/true_server.cxx
branches/pingus_sdl/src/true_server.hxx
branches/pingus_sdl/src/world.cxx
branches/pingus_sdl/src/world.hxx
branches/pingus_sdl/src/worldmap/dot.cxx
branches/pingus_sdl/src/worldmap/dot.hxx
branches/pingus_sdl/src/worldmap/dot_factory.cxx
branches/pingus_sdl/src/worldmap/dot_factory.hxx
branches/pingus_sdl/src/worldmap/drawable.cxx
branches/pingus_sdl/src/worldmap/drawable.hxx
branches/pingus_sdl/src/worldmap/drawable_factory.cxx
branches/pingus_sdl/src/worldmap/drawable_factory.hxx
branches/pingus_sdl/src/worldmap/graph.cxx
branches/pingus_sdl/src/worldmap/graph.hxx
branches/pingus_sdl/src/worldmap/level_dot.cxx
branches/pingus_sdl/src/worldmap/level_dot.hxx
branches/pingus_sdl/src/worldmap/manager.cxx
branches/pingus_sdl/src/worldmap/manager.hxx
branches/pingus_sdl/src/worldmap/metamap.cxx
branches/pingus_sdl/src/worldmap/metamap.hxx
branches/pingus_sdl/src/worldmap/path.cxx
branches/pingus_sdl/src/worldmap/path.hxx
branches/pingus_sdl/src/worldmap/path_drawable.cxx
branches/pingus_sdl/src/worldmap/path_drawable.hxx
branches/pingus_sdl/src/worldmap/path_graph.cxx
branches/pingus_sdl/src/worldmap/path_graph.hxx
branches/pingus_sdl/src/worldmap/pathfinder.hxx
branches/pingus_sdl/src/worldmap/pingus.cxx
branches/pingus_sdl/src/worldmap/pingus.hxx
branches/pingus_sdl/src/worldmap/sprite_drawable.cxx
branches/pingus_sdl/src/worldmap/sprite_drawable.hxx
branches/pingus_sdl/src/worldmap/surface_drawable.cxx
branches/pingus_sdl/src/worldmap/surface_drawable.hxx
branches/pingus_sdl/src/worldmap/world_dot.cxx
branches/pingus_sdl/src/worldmap/world_dot.hxx
branches/pingus_sdl/src/worldmap/worldmap.cxx
branches/pingus_sdl/src/worldmap/worldmap.hxx
branches/pingus_sdl/src/worldmap/worldmap_story.cxx
branches/pingus_sdl/src/worldmap/worldmap_story.hxx
branches/pingus_sdl/src/worldobj.cxx
branches/pingus_sdl/src/worldobj.hxx
branches/pingus_sdl/src/worldobj_factory.cxx
branches/pingus_sdl/src/worldobj_factory.hxx
branches/pingus_sdl/src/worldobjs/conveyor_belt.cxx
branches/pingus_sdl/src/worldobjs/conveyor_belt.hxx
branches/pingus_sdl/src/worldobjs/entrance.cxx
branches/pingus_sdl/src/worldobjs/entrance.hxx
branches/pingus_sdl/src/worldobjs/exit.cxx
branches/pingus_sdl/src/worldobjs/exit.hxx
branches/pingus_sdl/src/worldobjs/fake_exit.cxx
branches/pingus_sdl/src/worldobjs/fake_exit.hxx
branches/pingus_sdl/src/worldobjs/groundpiece.cxx
branches/pingus_sdl/src/worldobjs/groundpiece.hxx
branches/pingus_sdl/src/worldobjs/guillotine.cxx
branches/pingus_sdl/src/worldobjs/guillotine.hxx
branches/pingus_sdl/src/worldobjs/hammer.cxx
branches/pingus_sdl/src/worldobjs/hammer.hxx
branches/pingus_sdl/src/worldobjs/hotspot.cxx
branches/pingus_sdl/src/worldobjs/hotspot.hxx
branches/pingus_sdl/src/worldobjs/ice_block.cxx
branches/pingus_sdl/src/worldobjs/ice_block.hxx
branches/pingus_sdl/src/worldobjs/info_box.cxx
branches/pingus_sdl/src/worldobjs/info_box.hxx
branches/pingus_sdl/src/worldobjs/laser_exit.cxx
branches/pingus_sdl/src/worldobjs/laser_exit.hxx
branches/pingus_sdl/src/worldobjs/liquid.cxx
branches/pingus_sdl/src/worldobjs/liquid.hxx
branches/pingus_sdl/src/worldobjs/rain_generator.cxx
branches/pingus_sdl/src/worldobjs/rain_generator.hxx
branches/pingus_sdl/src/worldobjs/smasher.cxx
branches/pingus_sdl/src/worldobjs/smasher.hxx
branches/pingus_sdl/src/worldobjs/snow_generator.cxx
branches/pingus_sdl/src/worldobjs/snow_generator.hxx
branches/pingus_sdl/src/worldobjs/solid_color_background.cxx
branches/pingus_sdl/src/worldobjs/solid_color_background.hxx
branches/pingus_sdl/src/worldobjs/spike.cxx
branches/pingus_sdl/src/worldobjs/spike.hxx
branches/pingus_sdl/src/worldobjs/starfield_background.cxx
branches/pingus_sdl/src/worldobjs/starfield_background.hxx
branches/pingus_sdl/src/worldobjs/starfield_background_stars.cxx
branches/pingus_sdl/src/worldobjs/starfield_background_stars.hxx
branches/pingus_sdl/src/worldobjs/surface_background.cxx
branches/pingus_sdl/src/worldobjs/surface_background.hxx
branches/pingus_sdl/src/worldobjs/switch_door.cxx
branches/pingus_sdl/src/worldobjs/switch_door.hxx
branches/pingus_sdl/src/worldobjs/teleporter.cxx
branches/pingus_sdl/src/worldobjs/teleporter.hxx
branches/pingus_sdl/src/worldobjs/thunderstorm_background.cxx
branches/pingus_sdl/src/worldobjs/thunderstorm_background.hxx
branches/pingus_sdl/src/worldobjs/woodthing.cxx
branches/pingus_sdl/src/worldobjs/woodthing.hxx
branches/pingus_sdl/src/xml_eval.cxx
branches/pingus_sdl/src/xml_eval.hxx
branches/pingus_sdl/src/xml_file_reader.cxx
branches/pingus_sdl/src/xml_file_reader.hxx
branches/pingus_sdl/src/xml_file_writer.cxx
branches/pingus_sdl/src/xml_file_writer.hxx
branches/pingus_sdl/src/xml_pdf.cxx
branches/pingus_sdl/src/xml_pdf.hxx
branches/pingus_sdl/src/xml_pingus_level.cxx
branches/pingus_sdl/src/xml_pingus_level.hxx
Modified:
branches/pingus_sdl/src/SConscript
Log:
- renamed .?xx to .?pp
Modified: branches/pingus_sdl/src/SConscript
===================================================================
--- branches/pingus_sdl/src/SConscript 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/SConscript 2007-01-18 03:08:17 UTC (rev 2686)
@@ -57,75 +57,75 @@
env.Program('../pingus', [
-# # 'gui/buffer_graphic_context.cxx',
-# # 'indexed_canvas.cxx',
-# # 'input/axes/mouse_axis.cxx',
-# # 'pingus_level_test.cxx',
-# # 'sound/slot_manager.cxx',
-# # 'target_provider.cxx',
-# # 'theme.cxx',
-# # 'theme_selector.cxx',
-# # 'xml_eval.cxx',
+# # 'gui/buffer_graphic_context.cpp',
+# # 'indexed_canvas.cpp',
+# # 'input/axes/mouse_axis.cpp',
+# # 'pingus_level_test.cpp',
+# # 'sound/slot_manager.cpp',
+# # 'target_provider.cpp',
+# # 'theme.cpp',
+# # 'theme_selector.cpp',
+# # 'xml_eval.cpp',
-'action_holder.cxx',
-'actions/angel.cxx',
-'actions/basher.cxx',
-'actions/blocker.cxx',
-'actions/boarder.cxx',
-'actions/bomber.cxx',
-'actions/bridger.cxx',
-'actions/climber.cxx',
-'actions/digger.cxx',
-'actions/drown.cxx',
-'actions/exiter.cxx',
-'actions/faller.cxx',
-'actions/floater.cxx',
-'actions/jumper.cxx',
-'actions/laser_kill.cxx',
-'actions/miner.cxx',
-'actions/rocket_launcher.cxx',
-'actions/slider.cxx',
-'actions/smashed.cxx',
-'actions/splashed.cxx',
-'actions/superman.cxx',
-'actions/teleported.cxx',
-'actions/waiter.cxx',
-'actions/walker.cxx',
-# 'blitter.cxx',
-# 'blitter_test.cxx',
-'capture_rectangle.cxx',
-'cheat.cxx',
-'client.cxx',
-'col_map.cxx',
-'collider.cxx',
-'colliders/pingu_collider.cxx',
-'components/action_button.cxx',
-'components/button_panel.cxx',
-'components/hurry_up.cxx',
-'components/pingus_counter.cxx',
-'components/playfield.cxx',
-'components/smallmap.cxx',
-'components/time_display.cxx',
-'config.cxx',
-'console.cxx',
-'credits.cxx',
-'debug.cxx',
-'debug_stream.cxx',
-# 'demo_player.cxx',
-'demo_recorder.cxx',
-# 'demo_session.cxx',
-'direction.cxx',
-'display/drawing_context.cxx',
-'display/scene_context.cxx',
+'action_holder.cpp',
+'actions/angel.cpp',
+'actions/basher.cpp',
+'actions/blocker.cpp',
+'actions/boarder.cpp',
+'actions/bomber.cpp',
+'actions/bridger.cpp',
+'actions/climber.cpp',
+'actions/digger.cpp',
+'actions/drown.cpp',
+'actions/exiter.cpp',
+'actions/faller.cpp',
+'actions/floater.cpp',
+'actions/jumper.cpp',
+'actions/laser_kill.cpp',
+'actions/miner.cpp',
+'actions/rocket_launcher.cpp',
+'actions/slider.cpp',
+'actions/smashed.cpp',
+'actions/splashed.cpp',
+'actions/superman.cpp',
+'actions/teleported.cpp',
+'actions/waiter.cpp',
+'actions/walker.cpp',
+# 'blitter.cpp',
+# 'blitter_test.cpp',
+'capture_rectangle.cpp',
+'cheat.cpp',
+'client.cpp',
+'col_map.cpp',
+'collider.cpp',
+'colliders/pingu_collider.cpp',
+'components/action_button.cpp',
+'components/button_panel.cpp',
+'components/hurry_up.cpp',
+'components/pingus_counter.cpp',
+'components/playfield.cpp',
+'components/smallmap.cpp',
+'components/time_display.cpp',
+'config.cpp',
+'console.cpp',
+'credits.cpp',
+'debug.cpp',
+'debug_stream.cpp',
+# 'demo_player.cpp',
+'demo_recorder.cpp',
+# 'demo_session.cpp',
+'direction.cpp',
+'display/drawing_context.cpp',
+'display/scene_context.cpp',
-'editor/context_menu.cxx',
-'editor/editor_panel.cxx',
-'editor/editor_screen.cxx',
-'editor/editor_viewport.cxx',
-'editor/level_head.cxx',
-'editor/level_objs.cxx',
-'editor/panel_buttons.cxx',
-'editor/xml_level.cxx',
+'editor/context_menu.cpp',
+'editor/editor_panel.cpp',
+'editor/editor_screen.cpp',
+'editor/editor_viewport.cpp',
+'editor/level_head.cpp',
+'editor/level_objs.cpp',
+'editor/panel_buttons.cpp',
+'editor/xml_level.cpp',
'command_line.cpp',
'command_line_generic.cpp',
@@ -133,37 +133,37 @@
'pixel_buffer.cpp',
'collision_mask.cpp',
-'exit_menu.cxx',
-'file_dialog.cxx',
-'file_dialog_item.cxx',
-'file_reader.cxx',
+'exit_menu.cpp',
+'file_dialog.cpp',
+'file_dialog_item.cpp',
+'file_reader.cpp',
'sexpr_file_reader.cpp',
-'fonts.cxx',
+'fonts.cpp',
'font.cpp',
'sprite.cpp',
-'fps_counter.cxx',
-'game_session.cxx',
-'game_session_result.cxx',
-'game_time.cxx',
-'gettext.cxx',
-# 'global_event.cxx',
-'globals.cxx',
-'goal_manager.cxx',
-'graphic_context_state.cxx',
-'groundtype.cxx',
-'gui/checkbox.cxx',
-'gui/combobox.cxx',
-'gui/cursor.cxx',
-'gui/display.cxx',
-'gui/gui_manager.cxx',
-'gui/gui_screen.cxx',
-'gui/input_box.cxx',
-# 'gui/input_debug_screen.cxx',
-'gui/root_gui_manager.cxx',
-'gui/screen.cxx',
-'gui/screen_manager.cxx',
-'gui/screen_ptr.cxx',
-'gui/surface_button.cxx',
+'fps_counter.cpp',
+'game_session.cpp',
+'game_session_result.cpp',
+'game_time.cpp',
+'gettext.cpp',
+# 'global_event.cpp',
+'globals.cpp',
+'goal_manager.cpp',
+'graphic_context_state.cpp',
+'groundtype.cpp',
+'gui/checkbox.cpp',
+'gui/combobox.cpp',
+'gui/cursor.cpp',
+'gui/display.cpp',
+'gui/gui_manager.cpp',
+'gui/gui_screen.cpp',
+'gui/input_box.cpp',
+# 'gui/input_debug_screen.cpp',
+'gui/root_gui_manager.cpp',
+'gui/screen.cpp',
+'gui/screen_manager.cpp',
+'gui/screen_ptr.cpp',
+'gui/surface_button.cpp',
'lisp/getters.cpp',
'lisp/lexer.cpp',
@@ -172,139 +172,139 @@
'lisp/properties.cpp',
'lisp/writer.cpp',
-# # 'input/axes/button_axis.cxx',
-# # 'input/axes/inverted_axis.cxx',
-# # 'input/axes/joystick_axis.cxx',
-# # 'input/axes/multiple_axis.cxx',
-# # 'input/axis_factory.cxx',
-# # 'input/button_factory.cxx',
-# # 'input/buttons/double_button.cxx',
-# # 'input/buttons/joystick_button.cxx',
-# # 'input/buttons/key_button.cxx',
-# # 'input/buttons/mouse_button.cxx',
-# # 'input/buttons/multiple_button.cxx',
-# # 'input/buttons/triple_button.cxx',
-'input/controller.cxx',
-# # 'input/pointer_factory.cxx',
-# # 'input/pointers/axis_pointer.cxx',
-# # 'input/pointers/mouse_pointer.cxx',
-# # 'input/pointers/multiple_pointer.cxx',
-# # 'input/scroller_factory.cxx',
-# # 'input/scrollers/axis_scroller.cxx',
-# # 'input/scrollers/inverted_scroller.cxx',
-# # 'input/scrollers/joystick_scroller.cxx',
-# # 'input/scrollers/mouse_scroller.cxx',
-# # 'input/scrollers/multiple_scroller.cxx',
-# # 'input/scrollers/pointer_scroller.cxx',
+# # 'input/axes/button_axis.cpp',
+# # 'input/axes/inverted_axis.cpp',
+# # 'input/axes/joystick_axis.cpp',
+# # 'input/axes/multiple_axis.cpp',
+# # 'input/axis_factory.cpp',
+# # 'input/button_factory.cpp',
+# # 'input/buttons/double_button.cpp',
+# # 'input/buttons/joystick_button.cpp',
+# # 'input/buttons/key_button.cpp',
+# # 'input/buttons/mouse_button.cpp',
+# # 'input/buttons/multiple_button.cpp',
+# # 'input/buttons/triple_button.cpp',
+'input/controller.cpp',
+# # 'input/pointer_factory.cpp',
+# # 'input/pointers/axis_pointer.cpp',
+# # 'input/pointers/mouse_pointer.cpp',
+# # 'input/pointers/multiple_pointer.cpp',
+# # 'input/scroller_factory.cpp',
+# # 'input/scrollers/axis_scroller.cpp',
+# # 'input/scrollers/inverted_scroller.cpp',
+# # 'input/scrollers/joystick_scroller.cpp',
+# # 'input/scrollers/mouse_scroller.cpp',
+# # 'input/scrollers/multiple_scroller.cpp',
+# # 'input/scrollers/pointer_scroller.cpp',
-'layer_manager.cxx',
-'components/menu_button.cxx',
-'mover.cxx',
-'movers/linear_mover.cxx',
-'multiline_text.cxx',
-'particles/explosive_particle.cxx',
-'particles/ground_particle.cxx',
-'particles/pingu_particle_holder.cxx',
-'particles/rain_particle_holder.cxx',
-'particles/smoke_particle_holder.cxx',
-'particles/snow_particle_holder.cxx',
-'path_manager.cxx',
-'pingu.cxx',
-'pingu_action.cxx',
-'pingu_action_factory.cxx',
-'pingu_enums.cxx',
-'pingu_holder.cxx',
-'pingus_error.cxx',
-'pingus_level.cxx',
-'pingus_main.cxx',
-'pingus_menu.cxx',
-'pingus_menu_manager.cxx',
-'pingus_sub_menu.cxx',
-'plf_res_mgr.cxx',
-# 'plt_xml.cxx',
-# 'preview_renderer.cxx',
-'res_descriptor.cxx',
-'resource.cxx',
+'layer_manager.cpp',
+'components/menu_button.cpp',
+'mover.cpp',
+'movers/linear_mover.cpp',
+'multiline_text.cpp',
+'particles/explosive_particle.cpp',
+'particles/ground_particle.cpp',
+'particles/pingu_particle_holder.cpp',
+'particles/rain_particle_holder.cpp',
+'particles/smoke_particle_holder.cpp',
+'particles/snow_particle_holder.cpp',
+'path_manager.cpp',
+'pingu.cpp',
+'pingu_action.cpp',
+'pingu_action_factory.cpp',
+'pingu_enums.cpp',
+'pingu_holder.cpp',
+'pingus_error.cpp',
+'pingus_level.cpp',
+'pingus_main.cpp',
+'pingus_menu.cpp',
+'pingus_menu_manager.cpp',
+'pingus_sub_menu.cpp',
+'plf_res_mgr.cpp',
+# 'plt_xml.cpp',
+# 'preview_renderer.cpp',
+'res_descriptor.cpp',
+'resource.cpp',
'resource_manager.cpp',
-'resource_modifier.cxx',
-'result_screen.cxx',
-'savegame.cxx',
-'savegame_manager.cxx',
-# 'screenshot.cxx',
-'server.cxx',
-'server_event.cxx',
-'smallmap_image.cxx',
-'sound/sound.cxx',
-'sound/sound_dummy.cxx',
-# 'sound/sound_real.cxx',
-'sound/sound_res_mgr.cxx',
-'ground_map.cxx',
-'start_screen.cxx',
-'stat_manager.cxx',
-'state_sprite.cxx',
-'story_screen.cxx',
-'string_format.cxx',
+'resource_modifier.cpp',
+'result_screen.cpp',
+'savegame.cpp',
+'savegame_manager.cpp',
+# 'screenshot.cpp',
+'server.cpp',
+'server_event.cpp',
+'smallmap_image.cpp',
+'sound/sound.cpp',
+'sound/sound_dummy.cpp',
+# 'sound/sound_real.cpp',
+'sound/sound_res_mgr.cpp',
+'ground_map.cpp',
+'start_screen.cpp',
+'stat_manager.cpp',
+'state_sprite.cpp',
+'story_screen.cpp',
+'string_format.cpp',
'math/origin.cpp',
'math/rect.cpp',
-'system.cxx',
-'timer.cxx',
-'tinygettext/tinygettext.cxx',
-'true_server.cxx',
+'system.cpp',
+'timer.cpp',
+'tinygettext/tinygettext.cpp',
+'true_server.cpp',
'math/vector2f.cpp',
'math/vector2i.cpp',
'math/vector3f.cpp',
'physfs/physfs_sdl.cpp',
'physfs/physfs_stream.cpp',
-'world.cxx',
+'world.cpp',
-'worldmap/dot.cxx',
-'worldmap/dot_factory.cxx',
-'worldmap/drawable.cxx',
-'worldmap/drawable_factory.cxx',
-'worldmap/graph.cxx',
-'worldmap/level_dot.cxx',
-'worldmap/manager.cxx',
-'worldmap/metamap.cxx',
-'worldmap/path.cxx',
-'worldmap/path_drawable.cxx',
-'worldmap/path_graph.cxx',
-'worldmap/pingus.cxx',
-'worldmap/sprite_drawable.cxx',
-'worldmap/surface_drawable.cxx',
-'worldmap/world_dot.cxx',
-'worldmap/worldmap.cxx',
-'worldmap/worldmap_story.cxx',
-'worldobj.cxx',
-'worldobj_factory.cxx',
-'worldobjs/conveyor_belt.cxx',
-'worldobjs/entrance.cxx',
-'worldobjs/exit.cxx',
-'worldobjs/fake_exit.cxx',
-'worldobjs/groundpiece.cxx',
-'worldobjs/guillotine.cxx',
-'worldobjs/hammer.cxx',
-'worldobjs/hotspot.cxx',
-'worldobjs/ice_block.cxx',
-'worldobjs/info_box.cxx',
-'worldobjs/laser_exit.cxx',
-'worldobjs/liquid.cxx',
-'worldobjs/rain_generator.cxx',
-'worldobjs/smasher.cxx',
-'worldobjs/snow_generator.cxx',
-'worldobjs/solid_color_background.cxx',
-'worldobjs/spike.cxx',
-'worldobjs/starfield_background.cxx',
-'worldobjs/starfield_background_stars.cxx',
-'worldobjs/surface_background.cxx',
-'worldobjs/switch_door.cxx',
-'worldobjs/teleporter.cxx',
-'worldobjs/thunderstorm_background.cxx',
-'worldobjs/woodthing.cxx',
+'worldmap/dot.cpp',
+'worldmap/dot_factory.cpp',
+'worldmap/drawable.cpp',
+'worldmap/drawable_factory.cpp',
+'worldmap/graph.cpp',
+'worldmap/level_dot.cpp',
+'worldmap/manager.cpp',
+'worldmap/metamap.cpp',
+'worldmap/path.cpp',
+'worldmap/path_drawable.cpp',
+'worldmap/path_graph.cpp',
+'worldmap/pingus.cpp',
+'worldmap/sprite_drawable.cpp',
+'worldmap/surface_drawable.cpp',
+'worldmap/world_dot.cpp',
+'worldmap/worldmap.cpp',
+'worldmap/worldmap_story.cpp',
+'worldobj.cpp',
+'worldobj_factory.cpp',
+'worldobjs/conveyor_belt.cpp',
+'worldobjs/entrance.cpp',
+'worldobjs/exit.cpp',
+'worldobjs/fake_exit.cpp',
+'worldobjs/groundpiece.cpp',
+'worldobjs/guillotine.cpp',
+'worldobjs/hammer.cpp',
+'worldobjs/hotspot.cpp',
+'worldobjs/ice_block.cpp',
+'worldobjs/info_box.cpp',
+'worldobjs/laser_exit.cpp',
+'worldobjs/liquid.cpp',
+'worldobjs/rain_generator.cpp',
+'worldobjs/smasher.cpp',
+'worldobjs/snow_generator.cpp',
+'worldobjs/solid_color_background.cpp',
+'worldobjs/spike.cpp',
+'worldobjs/starfield_background.cpp',
+'worldobjs/starfield_background_stars.cpp',
+'worldobjs/surface_background.cpp',
+'worldobjs/switch_door.cpp',
+'worldobjs/teleporter.cpp',
+'worldobjs/thunderstorm_background.cpp',
+'worldobjs/woodthing.cpp',
-# 'xml_file_reader.cxx',
-# 'xml_file_writer.cxx',
-# 'xml_pdf.cxx',
-# 'xml_pingus_level.cxx'
+# 'xml_file_reader.cpp',
+# 'xml_file_writer.cpp',
+# 'xml_pdf.cpp',
+# 'xml_pingus_level.cpp'
],
LIBS = env['LIBS'],
LIBPATH = env['LIBPATH'],
Copied: branches/pingus_sdl/src/action_holder.cpp (from rev 2685,
branches/pingus_sdl/src/action_holder.cxx)
Deleted: branches/pingus_sdl/src/action_holder.cxx
===================================================================
--- branches/pingus_sdl/src/action_holder.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/action_holder.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,96 +0,0 @@
-// $Id: action_holder.cxx,v 1.14 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "pingus_level.hxx"
-#include "pingu_action_factory.hxx"
-#include "action_holder.hxx"
-#include "cheat.hxx"
-
-using namespace Actions;
-
-ActionHolder::ActionHolder(const PingusLevel& plf)
-{
- const std::map<std::string, int>& actions = plf.get_actions();
-
- for(std::map<std::string, int>::const_iterator i = actions.begin(); i !=
actions.end(); ++i)
- {
- set_actions(Actions::action_from_string(i->first), i->second);
- }
-}
-
-ActionHolder::~ActionHolder ()
-{
-}
-
-std::vector<Actions::ActionName>
-ActionHolder::get_available_actions()
-{
- std::vector<ActionName> ret;
-
- for(std::map<ActionName, int>::iterator i= available_actions.begin();
- i != available_actions.end(); ++i)
- ret.push_back(i->first);
-
- return ret;
-}
-
-void
-ActionHolder::set_actions (ActionName name, int available)
-{
- available_actions[name] = available;
-}
-
-void
-ActionHolder::push_action (ActionName name)
-{
- if (!Cheat::unlimited_actions)
- available_actions[name]++;
-}
-
-bool
-ActionHolder::pop_action (ActionName name)
-{
- if (Cheat::unlimited_actions)
- {
- return true;
- }
- else
- {
- int& avail = available_actions[name];
-
- if (avail > 0)
- {
- --avail;
- return true;
- }
- else
- {
- return false;
- }
- }
-}
-
-int
-ActionHolder::get_available (ActionName name)
-{
- return available_actions[name];
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/action_holder.hpp (from rev 2685,
branches/pingus_sdl/src/action_holder.hxx)
Deleted: branches/pingus_sdl/src/action_holder.hxx
===================================================================
--- branches/pingus_sdl/src/action_holder.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/action_holder.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,86 +0,0 @@
-// $Id: action_holder.hxx,v 1.14 2003/10/20 19:28:54 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTION_HOLDER_HXX
-#define HEADER_PINGUS_ACTION_HOLDER_HXX
-
-#include <map>
-#include <vector>
-#include "pingu_enums.hxx"
-
-
-class PingusLevel;
-class PinguAction;
-
-/**
- * The ActionHolder is the backend of the ButtonPanel. It is responsible for
- * creating new PinguActions and (if necessary) restricting the number of
- * actions that can be created.
- *
- */
-class ActionHolder
-{
-private:
- /** A map holding the number of available actions.
- * For each action <i>name</i> there is a map (<i>name</i>, <i>n</i>)
- * where the integer <i>n</i> indicates how much more actions
- * called <i>name</i> can be created.
- */
- std::map<Actions::ActionName, int> available_actions;
-
-public:
- /** Create an action holder from the number of actions given in a
- Pingus Level file */
- ActionHolder(const PingusLevel& plf);
- ~ActionHolder();
-
- /** @return a list of available actions in the current level */
- std::vector<Actions::ActionName> get_available_actions();
-
- /** Sets the number of actions, which are available in the pool.
- * @param name the name of the action
- * @param available the number of actions available
- */
- void set_actions (Actions::ActionName name, int available);
-
- /** Adds an action to the pool of actions, making one more action available
- * @param name the name of the action
- */
- void push_action (Actions::ActionName name);
-
- /** Removes an action from the pool of actions
- @return true if an action was available and removed, false if no
- actions where available */
- bool pop_action (Actions::ActionName name);
-
- /** Returns the number of actions of the specified name which are available
- * thru get_action()
- * @return 0 if the name is unknown FIXME: should use .find instead of []
- */
- int get_available (Actions::ActionName name);
-
-private:
- ActionHolder (const ActionHolder&);
- ActionHolder& operator= (const ActionHolder&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/angel.cpp (from rev 2685,
branches/pingus_sdl/src/actions/angel.cxx)
Deleted: branches/pingus_sdl/src/actions/angel.cxx
===================================================================
--- branches/pingus_sdl/src/actions/angel.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/angel.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,58 +0,0 @@
-// $Id: angel.cxx,v 1.20 2003/10/22 11:11:23 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <math.h>
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../resource.hxx"
-#include "../globals.hxx"
-#include "angel.hxx"
-
-namespace Actions {
-
-Angel::Angel (Pingu* p)
- : PinguAction(p),
- counter(0.0),
- x_pos(pingu->get_x()),
- sprite(Resource::load_sprite("pingus/player" + pingu->get_owner_str() +
"/angel"))
-{
-}
-
-void
-Angel::update ()
-{
- sprite.update ();
-
- counter += game_speed;
- pingu->set_pos((float)x_pos + 20 * (float)sin (counter * 3.0f),
pingu->get_y() - 50.0f * 0.025f);
-
- // Out of screen, let the pingu die
- if (pingu->get_y() < -32)
- pingu->set_status (PS_DEAD);
-}
-
-void
-Angel::draw (SceneContext& gc)
-{
- gc.color().draw (sprite, pingu->get_pos ());
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/angel.hpp (from rev 2685,
branches/pingus_sdl/src/actions/angel.hxx)
Deleted: branches/pingus_sdl/src/actions/angel.hxx
===================================================================
--- branches/pingus_sdl/src/actions/angel.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/angel.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,51 +0,0 @@
-// $Id: angel.hxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_ANGEL_HXX
-#define HEADER_PINGUS_ACTIONS_ANGEL_HXX
-
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Angel : public PinguAction
-{
-private:
- double counter;
- double x_pos;
- Sprite sprite;
-
-public:
- Angel (Pingu* p);
-
- ActionName get_type () const { return Actions::Angel; }
-
- void update ();
- void draw (SceneContext& gc);
-
-private:
- Angel (const Angel&);
- Angel& operator= (const Angel&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/basher.cpp (from rev 2685,
branches/pingus_sdl/src/actions/basher.cxx)
Deleted: branches/pingus_sdl/src/actions/basher.cxx
===================================================================
--- branches/pingus_sdl/src/actions/basher.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/basher.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,169 +0,0 @@
-// $Id: basher.cxx,v 1.33 2003/12/13 11:21:24 grumbel Exp $
-//
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../sound/sound.hxx"
-#include "../col_map.hxx"
-#include "../debug.hxx"
-#include "../globals.hxx"
-#include "../display/scene_context.hxx"
-#include "../ground_map.hxx"
-#include "../resource.hxx"
-#include "../pingu.hxx"
-#include "../world.hxx"
-#include "../worldobj.hxx"
-#include "basher.hxx"
-
-namespace Actions {
-
-Basher::Basher (Pingu* p)
- : PinguAction(p),
- bash_radius(Resource::load_collision_mask("other/bash_radius")),
- basher_c(0),
- first_bash(true)
-{
- sprite.load(Direction::LEFT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/basher/left"));
- sprite.load(Direction::RIGHT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/basher/right"));
-
- bash_radius_width = bash_radius.get_width();
-
- // The +1 is just in case bash_radius is an odd no. In which case, want to
- // round up the result.
- bash_reach = static_cast<int>(bash_radius_width + 1) / 2;
-
- // Start a bash even so the action will stops instantly after the
- // first bash
- bash();
-}
-
-void
-Basher::draw (SceneContext& gc)
-{
- gc.color().draw(sprite[pingu->direction], pingu->get_pos());
-}
-
-void
-Basher::update ()
-{
- sprite[pingu->direction].update();
-
- ++basher_c;
- if (basher_c % 3 == 0)
- {
- walk_forward();
-
- // If on walking forward the Basher has now walked on to water or lava
- if (rel_getpixel(0, -1) == Groundtype::GP_WATER
- || rel_getpixel(0, -1) == Groundtype::GP_LAVA)
- {
- pingu->set_action(Actions::Drown);
- }
- // If walking on to something (i.e. hasn't fallen)
- else if (rel_getpixel(0, -1) != Groundtype::GP_NOTHING)
- {
- // If the Basher has walked into something that it won't be able to
- // bash
- if (rel_getpixel(0, 0) == Groundtype::GP_SOLID
- || rel_getpixel(0, pingu_height) == Groundtype::GP_SOLID)
- {
- // Change direction and let walk code walk forward/up to get out.
- Sound::PingusSound::play_sound("chink");
- pingu->direction.change();
- pingu->set_action(Actions::Walker);
- }
- else if (have_something_to_dig())
- {
- // We only bash every second step, cause the Pingus would
- // get trapped otherwise in the bashing area.
- if (basher_c % 2 == 0)
- bash();
- }
- else if (sprite[pingu->direction].get_current_frame()
- / float(sprite[pingu->direction].get_frame_count()) > 0.6f)
- { // FIXME: EVIL! Engine must not relay on graphic
- pingu->set_action(Actions::Walker);
- }
- }
- }
-}
-
-void
-Basher::bash()
-{
- WorldObj::get_world()->remove(bash_radius,
- static_cast<int>(pingu->get_x () -
(bash_radius_width / 2)),
- static_cast<int>(pingu->get_y () -
bash_radius_width + 1));
-}
-
-void
-Basher::walk_forward()
-{
- int y_inc = 0;
-
- // Find the correct y position to go to next
- for (y_inc = 0; y_inc >= -max_steps_down; --y_inc)
- {
- // If there is something below, get out of this loop
- if (rel_getpixel(0, y_inc - 1) != Groundtype::GP_NOTHING)
- break;
- }
-
- if (y_inc < -max_steps_down)
- {
- // The step down is too much. So stop being a Basher and be a Faller.
- pingu->set_action(Actions::Faller);
- }
- else
- {
- // Note that Pingu::set_pos() is the 'reverse' of the y co-ords of
- // rel_getpixel()
- pingu->set_pos(pingu->get_x() + static_cast<int>(pingu->direction),
- pingu->get_y() - y_inc);
- }
-}
-
-bool
-Basher::have_something_to_dig()
-{
- if (first_bash)
- {
- first_bash = false;
- return true;
- }
-
- // Check that there is something "within" the Basher's reach
- for(int x = 0; x <= bash_reach; ++x)
- {
- for (int y = min_bash_height; y <= max_bash_height; ++y)
- {
- if (rel_getpixel(x, y) == Groundtype::GP_GROUND)
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Basher: Found something to dig..."
<< std::endl;
- return true;
- }
- }
- }
-
- //std::cout << "nothing to dig found" << std::endl;
- return false;
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/basher.hpp (from rev 2685,
branches/pingus_sdl/src/actions/basher.hxx)
Deleted: branches/pingus_sdl/src/actions/basher.hxx
===================================================================
--- branches/pingus_sdl/src/actions/basher.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/basher.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,76 +0,0 @@
-// $Id: basher.hxx,v 1.19 2003/12/13 11:21:24 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_BASHER_HXX
-#define HEADER_PINGUS_ACTIONS_BASHER_HXX
-
-#include "../state_sprite.hxx"
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Basher : public PinguAction
-{
-private:
- StateSprite sprite;
- CollisionMask bash_radius;
- int basher_c;
- bool first_bash;
-
- /** Width of the bash_radius surface */
- unsigned int bash_radius_width;
-
- /** The no. of pixels ahead that a Basher checks for something bashable.
- This is initialised using the size of the bash_radius surface. */
- int bash_reach;
-
- /** Defines the minimum "wall" height needed for a bash to happen. */
- enum { min_bash_height = 5 };
-
- /** Defines the maximum height up to which a check is made to see if there
- is anything to bash. Best to make this at least (min_bash_height +
- pingu_height). */
- enum { max_bash_height = 33 };
-
- /** Defines the maximum no. of steps down a Basher can go down before it
- stops being a Basher and turns into a Faller. */
- enum { max_steps_down = 3 };
-
-public:
- Basher (Pingu* p);
-
- ActionName get_type () const { return Actions::Basher; }
-
- void draw (SceneContext& gc);
- void update ();
-
- bool have_something_to_dig ();
- void walk_forward ();
- void bash ();
-
-private:
- Basher (const Basher&);
- Basher& operator= (const Basher&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/blocker.cpp (from rev 2685,
branches/pingus_sdl/src/actions/blocker.cxx)
Deleted: branches/pingus_sdl/src/actions/blocker.cxx
===================================================================
--- branches/pingus_sdl/src/actions/blocker.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/blocker.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,107 +0,0 @@
-// $Id: blocker.cxx,v 1.21 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../world.hxx"
-#include "blocker.hxx"
-
-namespace Actions {
-
-Blocker::Blocker(Pingu* p)
- : PinguAction(p)
-{
- sprite.load(Direction::LEFT, "pingus/player" + pingu->get_owner_str() +
"/blocker/left");
- sprite.load(Direction::RIGHT, "pingus/player" + pingu->get_owner_str() +
"/blocker/right");
-
- if ( rel_getpixel(0,-1) == Groundtype::GP_NOTHING
- && rel_getpixel(0, -2) == Groundtype::GP_GROUND)
- {
- pingu->set_x(pingu->get_x() + 1);
- }
- else if ( rel_getpixel(0,-1) == Groundtype::GP_NOTHING
- && rel_getpixel(0,-2) == Groundtype::GP_NOTHING
- && rel_getpixel(0,-3) == Groundtype::GP_GROUND)
- {
- pingu->set_y(pingu->get_y() + 2);
- }
-}
-
-void
-Blocker::update()
-{
- if (!standing_on_ground())
- {
- pingu->set_action(Actions::Faller);
- }
- else
- {
- // FIXME: PinguHolder iterations should be handled otherwise
- PinguHolder* pingus = WorldObj::get_world()->get_pingus();
- for(PinguIter i = pingus->begin(); i != pingus->end(); ++i)
- {
- catch_pingu(*i);
- }
- }
- sprite.update();
-}
-
-void
-Blocker::draw (SceneContext& gc)
-{
- gc.color().draw(sprite[pingu->direction], pingu->get_pos());
-}
-
-bool
-Blocker::standing_on_ground()
-{
- return (rel_getpixel(0,-1) != Groundtype::GP_NOTHING);
-}
-
-void
-Blocker::catch_pingu(Pingu* target)
-{
- if (target != pingu) // avoid 'self' catch
- {
- if (target->get_x () > pingu->get_x () - 16
- && target->get_x () < pingu->get_x () + 16
- && target->get_y () > pingu->get_y () - 32
- && target->get_y () < pingu->get_y () + 5
- )
- {
- if (target->get_x () > pingu->get_x ()) {
- target->direction.right();
- } else {
- target->direction.left();
- }
- }
- }
-}
-
-int
-Blocker::y_offset(void)
-{
- return -33;
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/blocker.hpp (from rev 2685,
branches/pingus_sdl/src/actions/blocker.hxx)
Deleted: branches/pingus_sdl/src/actions/blocker.hxx
===================================================================
--- branches/pingus_sdl/src/actions/blocker.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/blocker.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,55 +0,0 @@
-// $Id: blocker.hxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_BLOCKER_HXX
-#define HEADER_PINGUS_ACTIONS_BLOCKER_HXX
-
-#include "../state_sprite.hxx"
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Blocker : public PinguAction
-{
-private:
- StateSprite sprite;
-
-public:
- Blocker (Pingu* p);
-
- int y_offset ();
-
- ActionName get_type() const { return Actions::Blocker; }
-
- void draw (SceneContext& gc);
- void update();
-
-private:
- bool standing_on_ground();
- void catch_pingu(Pingu* pingu);
-
- Blocker (const Blocker&);
- Blocker& operator= (const Blocker&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/boarder.cpp (from rev 2685,
branches/pingus_sdl/src/actions/boarder.cxx)
Deleted: branches/pingus_sdl/src/actions/boarder.cxx
===================================================================
--- branches/pingus_sdl/src/actions/boarder.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/boarder.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,95 +0,0 @@
-// $Id: boarder.cxx,v 1.17 2003/10/22 11:11:23 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../math/vector3f.hpp"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../resource.hxx"
-#include "boarder.hxx"
-
-namespace Actions {
-
-Boarder::Boarder (Pingu* p)
- : PinguAction(p),
- x_pos(pingu->get_x()),
- speed(0.0)
-{
- sprite.load(Direction::LEFT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/boarder/left"));
- sprite.load(Direction::RIGHT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/boarder/right"));
-}
-
-void
-Boarder::update ()
-{
- sprite[pingu->direction].update();
-
- if (on_ground())
- {
- if (speed < 15.0)
- speed += 15.0 * 25.0f/1000.0f;
- else {
- speed = 15.0;
- }
-
- // Incremental update so that we don't skip pixels
- Vector3f new_pos = pingu->get_pos();
- new_pos.x = new_pos.x + pingu->direction * speed;
- while (new_pos.x != pingu->get_pos().x)
- {
- Vector3f old_pos = pingu->get_pos();
- pingu->set_pos(Vector3f(old_pos.x + (old_pos.x < new_pos.x) ? 1.0f :
-1.0f,
- old_pos.y, old_pos.z));
-
- if (pingu->rel_getpixel (1, 0))
- {
- // Hit a wall
- pingu->set_pos(old_pos); // + (pingu->direction * 10);
- ////pingu->pos.y = 10;
-
- pingu->apply_force (Vector3f(float(speed * pingu->direction * 0.5),
- -float(speed * abs(pingu->direction) * 0.5)));
- pingu->set_action(Actions::Walker);
- return;
- }
- }
- }
- else
- {
- pingu->apply_force (Vector3f((float)speed * pingu->direction, 0));
- pingu->set_action(Actions::Walker);
- }
-}
-
-void
-Boarder::draw (SceneContext& gc)
-{
- gc.color().draw(sprite[pingu->direction], pingu->get_pos ());
-}
-
-bool
-Boarder::on_ground ()
-{
- return pingu->rel_getpixel (0, -1) || pingu->rel_getpixel (0, -2);
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/boarder.hpp (from rev 2685,
branches/pingus_sdl/src/actions/boarder.hxx)
Deleted: branches/pingus_sdl/src/actions/boarder.hxx
===================================================================
--- branches/pingus_sdl/src/actions/boarder.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/boarder.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,56 +0,0 @@
-// $Id: boarder.hxx,v 1.15 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_BOARDER_HXX
-#define HEADER_PINGUS_ACTIONS_BOARDER_HXX
-
-#include "../pingu_action.hxx"
-#include "../state_sprite.hxx"
-
-namespace Actions {
-
-/** The Boarder action causes a pingu to use a skateboard to move
- forward. */
-class Boarder : public PinguAction
-{
-private:
- //double counter;
- float x_pos;
- float speed;
- StateSprite sprite;
-public:
- Boarder (Pingu* p);
-
- ActionName get_type () const { return Actions::Boarder; }
-
- void draw (SceneContext& gc);
- void update ();
-
-private:
- bool on_ground ();
-
- Boarder (const Boarder&);
- Boarder& operator= (const Boarder&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/bomber.cpp (from rev 2685,
branches/pingus_sdl/src/actions/bomber.cxx)
Deleted: branches/pingus_sdl/src/actions/bomber.cxx
===================================================================
--- branches/pingus_sdl/src/actions/bomber.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/bomber.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,130 +0,0 @@
-// $Id: bomber.cxx,v 1.37 2003/10/22 11:11:23 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <math.h>
-#include "../debug.hxx"
-#include "../globals.hxx"
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_enums.hxx"
-#include "../ground_map.hxx"
-#include "../world.hxx"
-#include "../resource.hxx"
-#include "../particles/pingu_particle_holder.hxx"
-#include "../colliders/pingu_collider.hxx"
-#include "../movers/linear_mover.hxx"
-#include "bomber.hxx"
-
-namespace Actions {
-
-Bomber::Bomber (Pingu* p)
- : PinguAction(p),
- particle_thrown(false),
- sound_played(false),
- gfx_exploded(false),
- colmap_exploded(false),
- explo_surf(Resource::load_sprite("pingus/player" + pingu->get_owner_str()
+ "/explo"))
-{
- sprite.load(Direction::LEFT, "pingus/player" + pingu->get_owner_str() +
"/bomber/left");
- sprite.load(Direction::RIGHT, "pingus/player" + pingu->get_owner_str() +
"/bomber/right");
-
- bomber_radius = Resource::load_collision_mask("other/bomber_radius");
-}
-
-void
-Bomber::on_successfull_apply ()
-{
- WorldObj::get_world()->play_sound("ohno", pingu->get_pos ());
-}
-
-void
-Bomber::draw (SceneContext& gc)
-{
- if (sprite[pingu->direction].get_current_frame() >= 13 && !gfx_exploded)
- {
- gc.color().draw (explo_surf, Vector3f(pingu->get_x () - 32, pingu->get_y
() - 48));
- gfx_exploded = true;
- }
-
- gc.color().draw(sprite[pingu->direction], pingu->get_pos ());
-}
-
-void
-Bomber::update ()
-{
- sprite.update ();
-
- Movers::LinearMover mover(WorldObj::get_world(), pingu->get_pos());
-
- Vector3f velocity = pingu->get_velocity();
-
- // Move the Pingu
- mover.update(velocity, Colliders::PinguCollider(pingu_height));
-
- pingu->set_pos(mover.get_pos());
-
- // If the Bomber hasn't 'exploded' yet and it has hit Water or Lava
- if (sprite[pingu->direction].get_current_frame() <= 9 && (rel_getpixel(0,
-1) == Groundtype::GP_WATER
- || rel_getpixel(0, -1) == Groundtype::GP_LAVA))
- {
- pingu->set_action(Actions::Drown);
- return;
- }
-
- // If the Bomber hasn't 'exploded' yet and it has hit the ground too quickly
- if (sprite[pingu->direction].get_current_frame () <= 9 && rel_getpixel(0,
-1) != Groundtype::GP_NOTHING
- && velocity.y > deadly_velocity)
- {
- pingu->set_action(Actions::Splashed);
- return;
- }
-
- if (sprite[pingu->direction].get_current_frame () > 9 && !sound_played) {
- WorldObj::get_world()->play_sound("plop", pingu->get_pos ());
- sound_played = true;
- }
-
- // Throwing particles
- if (sprite[pingu->direction].get_current_frame () > 12 && !particle_thrown)
- {
- particle_thrown = true;
-
WorldObj::get_world()->get_pingu_particle_holder()->add_particle(static_cast<int>(pingu->get_x()),
-
static_cast<int>(pingu->get_y()) - 5);
- }
-
-
- if (sprite[pingu->direction].get_current_frame () >= 13 && !colmap_exploded)
- {
- colmap_exploded = true;
- WorldObj::get_world()->remove(bomber_radius,
-
static_cast<int>(pingu->get_x () - (bomber_radius.get_width()/2)),
-
static_cast<int>(pingu->get_y () - 16 - (bomber_radius.get_width()/2)));
- }
-
- // The pingu explode
- if (sprite[pingu->direction].is_finished ())
- {
- pingu->set_status(PS_DEAD);
- }
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/bomber.hpp (from rev 2685,
branches/pingus_sdl/src/actions/bomber.hxx)
Deleted: branches/pingus_sdl/src/actions/bomber.hxx
===================================================================
--- branches/pingus_sdl/src/actions/bomber.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/bomber.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,64 +0,0 @@
-// $Id: bomber.hxx,v 1.21 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_BOMBER_HXX
-#define HEADER_PINGUS_ACTIONS_BOMBER_HXX
-
-#include "../state_sprite.hxx"
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-/** An action with lets the Pingu explode. After the explosion the the
- Pingu leaves a hole inside the ground. */
-class Bomber : public PinguAction
-{
-private:
- bool particle_thrown;
- bool sound_played;
- bool gfx_exploded;
- bool colmap_exploded;
-
- CollisionMask bomber_radius;
- StateSprite sprite;
-
- Sprite explo_surf;
-
-public:
- Bomber (Pingu* p);
-
- ActionName get_type() const { return Actions::Bomber; }
- ActionType get_activation_mode() const { return COUNTDOWN_TRIGGERED; }
-
- void draw (SceneContext& gc);
- void update();
-
- int activation_time() { return 150; }
- void on_successfull_apply ();
-
-private:
- Bomber (const Bomber&);
- Bomber& operator= (const Bomber&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/bridger.cpp (from rev 2685,
branches/pingus_sdl/src/actions/bridger.cxx)
Deleted: branches/pingus_sdl/src/actions/bridger.cxx
===================================================================
--- branches/pingus_sdl/src/actions/bridger.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/bridger.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,252 +0,0 @@
-// $Id: bridger.cxx,v 1.33 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <cassert>
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../ground_map.hxx"
-#include "../resource.hxx"
-#include "../sound/sound.hxx"
-#include "../world.hxx"
-#include "../worldobj.hxx"
-#include "../gettext.h"
-#include "bridger.hxx"
-
-namespace Actions {
-
-Bridger::Bridger (Pingu* p)
- : PinguAction(p),
- mode(B_BUILDING),
- bricks(MAX_BRICKS),
- block_build(false),
- name(_("Bridger") + std::string(" (")) ////+ CL_String::to(bricks) + ")")
-{
- walk_sprite.load (Direction::LEFT, Resource::load_sprite("pingus/player" +
-
pingu->get_owner_str() + "/bridger_walk/left"));
- walk_sprite.load (Direction::RIGHT, Resource::load_sprite("pingus/player" +
-
pingu->get_owner_str() + "/bridger_walk/right"));
-
- build_sprite.load (Direction::LEFT, Resource::load_sprite("pingus/player" +
-
pingu->get_owner_str() + "/bridger/left"));
- build_sprite.load (Direction::RIGHT, Resource::load_sprite("pingus/player" +
-
pingu->get_owner_str() + "/bridger/right"));
-
- brick_l = Resource::load_collision_mask("other/brick_left");
- brick_r = Resource::load_collision_mask("other/brick_right");
-}
-
-void
-Bridger::draw (SceneContext& gc)
-{
- int x_offset(6), y_offset(4);
-
- if (bricks == MAX_BRICKS) {
- x_offset = -4;
- y_offset = 0;
-
- } else if (bricks == MAX_BRICKS - 1) {
- x_offset = 0;
- y_offset = 1;
- } else if (bricks == MAX_BRICKS - 2) {
- x_offset = 3;
- y_offset = 2;
- }
-
- switch (mode)
- {
- case B_BUILDING:
- gc.color().draw(build_sprite[pingu->direction],
Vector3f(pingu->get_pos().x - (x_offset * pingu->direction),
-
pingu->get_pos().y + y_offset));
- break;
-
- case B_WALKING:
- gc.color().draw(walk_sprite[pingu->direction],
Vector3f(pingu->get_pos().x - (x_offset * pingu->direction),
- pingu->get_pos().y
+ y_offset));
- break;
- }
-}
-
-void
-Bridger::update()
-{
- switch (mode)
- {
- case B_BUILDING:
- update_build ();
- break;
-
- case B_WALKING:
- update_walk ();
- break;
- }
-}
-
-void
-Bridger::update_walk ()
-{
- if (walk_sprite[pingu->direction].is_finished ()) // FIXME: Dangerous! might
not be fixed timing
- {
- if (way_is_free())
- {
- mode = B_BUILDING;
- block_build = false;
- walk_sprite[pingu->direction].restart();
- walk_one_step_up();
- }
- else // We reached a wall...
- {
- pingu->direction.change ();
- pingu->set_action (Actions::Walker);
- return;
- }
- }
- else
- {
- walk_sprite.update ();
- }
-}
-
-void
-Bridger::update_build ()
-{
- build_sprite[pingu->direction].update (0.033);
-
- if (build_sprite[pingu->direction].get_current_frame () >= 7 && !block_build)
- {
- block_build = true;
-
- if (bricks > 0)
- {
- if (brick_placement_allowed())
- place_a_brick();
- else
- {
- pingu->direction.change ();
- pingu->set_action (Actions::Walker);
- return;
- }
- }
- else // Out of bricks
- {
- pingu->set_action(Actions::Waiter);
- return;
- }
- }
-
- if (build_sprite[pingu->direction].is_finished ())
- {
- mode = B_WALKING;
- build_sprite[pingu->direction].restart();
- }
-}
-
-// way_is_free() needs to stop BRIDGERS from getting stuck between a brick
-// and the ceiling. The routine also stops cases of Bridgers building up but
-// then not being able to walk all the way down the bridge the it has built.
-// Even though the routine may be the same as brick_placement_allowed(), it is
-// best to keep them apart as they may need to be independent of each other if
-// there needs to be a patch.
-bool
-Bridger::way_is_free()
-{
- bool way_free = true;
-
- for (int x_inc = 1; x_inc <= 4; x_inc++)
- {
- if (rel_getpixel(x_inc, 2) != Groundtype::GP_NOTHING
- || head_collision_on_walk(x_inc, 2))
- {
- way_free = false;
- break;
- }
- }
-
- return way_free;
-}
-
-// brick_placement_allowed() is mainly for stopping WALKERS from getting stuck
-// between a brick and the ceiling. Even though the routine may be the same,
-// as way_is_free() it is best to keep them apart as they may need to be
-// independent of each other if there needs to be a patch.
-bool
-Bridger::brick_placement_allowed(void)
-{
-#ifdef BRIDGER_HEAD_COLLISION_CHECK
- bool brick_allowed = true;
-
- // Don't allow a brick to be placed if a Pingu would have a head collision
- // if it walked along the whole of the brick. Otherwise the Pingu,
- // especially a walker, could get stuck between the brick and the ceiling.
- for (int x_inc = 1; x_inc <= brick_length; ++x_inc)
- {
- if (head_collision_on_walk(x_inc, 2))
- {
- brick_allowed = false;
- break;
- }
- }
-
- return brick_allowed;
-#else
- return !head_collision_on_walk(0, 2);
-#endif
-}
-
-void
-Bridger::place_a_brick()
-{
- bricks--;
- name = _("Bridger") + std::string(" (");//// + CL_String::to(bricks) + ")";
-
- if (bricks < 4)
- Sound::PingusSound::play_sound("ting");
-
- if (pingu->direction.is_right())
- {
- WorldObj::get_world()->put(brick_r,
- static_cast<int>(pingu->get_pos().x + 10 -
brick_r.get_width()),
- static_cast<int>(pingu->get_pos().y),
- Groundtype::GP_BRIDGE);
- }
- else
- {
- WorldObj::get_world()->put(brick_r,
-
static_cast<int>(pingu->get_pos().x - 10),
-
static_cast<int>(pingu->get_pos().y),
- Groundtype::GP_BRIDGE);
- }
-}
-
-void
-Bridger::walk_one_step_up()
-{
- pingu->set_pos(pingu->get_pos().x + (float)(4 * pingu->direction),
- pingu->get_pos().y - 2);
-}
-
-std::string
-Bridger::get_name () const
-{
- return name;
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/bridger.hpp (from rev 2685,
branches/pingus_sdl/src/actions/bridger.hxx)
Deleted: branches/pingus_sdl/src/actions/bridger.hxx
===================================================================
--- branches/pingus_sdl/src/actions/bridger.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/bridger.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,74 +0,0 @@
-// $Id: bridger.hxx,v 1.19 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_BRIDGER_HXX
-#define HEADER_PINGUS_ACTIONS_BRIDGER_HXX
-
-#include "../math/vector3f.hpp"
-#include "../pingu_action.hxx"
-#include "../state_sprite.hxx"
-
-namespace Actions {
-
-class Bridger : public PinguAction
-{
-private:
- enum Mode { B_WALKING, B_BUILDING } mode;
- enum { MAX_BRICKS = 15 };
- enum { brick_length = 16 };
-
-private:
- StateSprite walk_sprite;
- StateSprite build_sprite;
- CollisionMask brick_l;
- CollisionMask brick_r;
-
- int bricks;
- //int step;
- //int do_steps;
- bool block_build;
-
- std::string name;
-public:
- Bridger(Pingu*);
-
- std::string get_name () const;
- ActionName get_type () const { return Actions::Bridger; }
-
- void update ();
- void update_build ();
- void update_walk ();
-
- void draw (SceneContext& gc);
-
- bool way_is_free ();
- bool brick_placement_allowed (void);
- void place_a_brick ();
- void walk_one_step_up ();
-
-private:
- Bridger (const Bridger&);
- Bridger& operator= (const Bridger&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/climber.cpp (from rev 2685,
branches/pingus_sdl/src/actions/climber.cxx)
Deleted: branches/pingus_sdl/src/actions/climber.cxx
===================================================================
--- branches/pingus_sdl/src/actions/climber.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/climber.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,96 +0,0 @@
-// $Id: climber.cxx,v 1.23 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../resource.hxx"
-#include "../pingu.hxx"
-#include "climber.hxx"
-
-namespace Actions {
-
-Climber::Climber (Pingu* p)
- : PinguAction(p)
-{
- sprite.load(Direction::LEFT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/climber/left"));
- sprite.load(Direction::RIGHT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/climber/right"));
-}
-
-void
-Climber::update ()
-{
- sprite[pingu->direction].update();
-
- // If above is free
- if ( rel_getpixel(0, 1) == Groundtype::GP_NOTHING
- || rel_getpixel(0, 1) == Groundtype::GP_BRIDGE)
- {
- // and there is still ground to walk on
- if (rel_getpixel(1, 1) != Groundtype::GP_NOTHING)
- {
- pingu->set_pos(pingu->get_x(),
- pingu->get_y() - 1);
- return;
- }
- else if (rel_getpixel(1, 1) == Groundtype::GP_NOTHING)
- {
- // std::cout << "Climber failed, no more wall" << std::endl;
-
- // If Pingu able to get to new position without head collision
- if (!head_collision_on_walk(pingu->direction, 1))
- {
- // Get ready to walk
- pingu->set_pos(pingu->get_x() + pingu->direction,
- pingu->get_y() - 1);
- }
- else
- {
- // Get ready to fall
- pingu->direction.change();
- }
-
- // Finish climbing.
- pingu->set_action(Actions::Walker);
- }
- }
- else
- {
- // std::cout << "Climber failed, falling down" << std::endl;
- pingu->direction.change();
- pingu->set_action(Actions::Walker);
- }
-}
-
-void
-Climber::draw (SceneContext& gc)
-{
- gc.color().draw(sprite[pingu->direction], pingu->get_pos());
-}
-
-bool
-Climber::change_allowed(ActionName new_action)
-{
- return (new_action == Actions::Floater);
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/climber.hpp (from rev 2685,
branches/pingus_sdl/src/actions/climber.hxx)
Deleted: branches/pingus_sdl/src/actions/climber.hxx
===================================================================
--- branches/pingus_sdl/src/actions/climber.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/climber.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,57 +0,0 @@
-// $Id: climber.hxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_CLIMBER_HXX
-#define HEADER_PINGUS_ACTIONS_CLIMBER_HXX
-
-#include "../state_sprite.hxx"
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Climber : public PinguAction
-{
-private:
- StateSprite sprite;
- int sprite_width;
- int sprite_height;
-
-public:
- Climber (Pingu*);
-
- ActionName get_type () const { return Actions::Climber; }
- ActionType get_activation_mode () const { return WALL_TRIGGERED; }
-
- void draw (SceneContext& gc);
-
- void update ();
-
- char get_persistent_char () { return 'c'; }
- bool change_allowed(ActionName new_action);
-
-private:
- Climber (const Climber&);
- Climber& operator= (const Climber&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/digger.cpp (from rev 2685,
branches/pingus_sdl/src/actions/digger.cxx)
Deleted: branches/pingus_sdl/src/actions/digger.cxx
===================================================================
--- branches/pingus_sdl/src/actions/digger.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/digger.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,109 +0,0 @@
-// $Id: digger.cxx,v 1.26 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <cstdio>
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../ground_map.hxx"
-#include "../world.hxx"
-#include "../worldobj.hxx"
-#include "../resource.hxx"
-#include "../sound/sound.hxx"
-#include "../pingu.hxx"
-#include "digger.hxx"
-
-namespace Actions {
-
-Digger::Digger (Pingu* p)
- : PinguAction(p),
- digger_radius(Resource::load_collision_mask("other/digger_radius")),
- digger_radius_gfx(Resource::load_collision_mask("other/digger_radius")),
- digger_c(0)
-{
- digger_radius_width = digger_radius.get_width();
- digger_radius_height = digger_radius.get_height();
-
- digger_radius_gfx_width = digger_radius_gfx.get_width();
- digger_radius_gfx_height = digger_radius_gfx.get_height();
-
- sprite = Resource::load_sprite("pingus/player" + pingu->get_owner_str() +
"/digger/left");
-}
-
-void
-Digger::update ()
-{
- sprite.update ();
-
- if (rel_getpixel(0, -1) == Groundtype::GP_WATER
- || rel_getpixel(0, -1) == Groundtype::GP_LAVA)
- {
- pingu->set_action(Actions::Drown);
- return;
- }
-
- if (++digger_c >= 5)
- {
- digger_c = 0;
- dig();
- }
-
- if (!have_something_to_dig())
- {
- dig ();
- pingu->set_action(Actions::Walker);
- }
-}
-
-bool
-Digger::have_something_to_dig ()
-{
- if (rel_getpixel(0, -1) != Groundtype::GP_NOTHING)
- {
- if (rel_getpixel(0, -1) == Groundtype::GP_SOLID)
- {
- Sound::PingusSound::play_sound("chink");
- return false;
- }
- else
- return true;
- }
- else
- {
- return false;
- }
-}
-
-void
-Digger::dig ()
-{
- WorldObj::get_world()->remove(digger_radius,
- static_cast<int>(pingu->get_pos().x -
(digger_radius_width / 2)),
- static_cast<int>(pingu->get_pos().y -
digger_radius_height + 2));
- pingu->set_pos(pingu->get_pos().x, pingu->get_pos().y + 1.0f);
-}
-
-void
-Digger::draw (SceneContext& gc)
-{
- gc.color().draw(sprite, pingu->get_pos ());
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/digger.hpp (from rev 2685,
branches/pingus_sdl/src/actions/digger.hxx)
Deleted: branches/pingus_sdl/src/actions/digger.hxx
===================================================================
--- branches/pingus_sdl/src/actions/digger.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/digger.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,67 +0,0 @@
-// $Id: digger.hxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_DIGGER_HXX
-#define HEADER_PINGUS_ACTIONS_DIGGER_HXX
-
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Digger : public PinguAction
-{
-private:
- CollisionMask digger_radius;
- CollisionMask digger_radius_gfx;
- Sprite sprite;
- int digger_c;
-
- /** Width of the digger_radius surface */
- unsigned int digger_radius_width;
-
- /** Height of the digger_radius surface */
- unsigned int digger_radius_height;
-
- /** Width of the digger_radius_gfx surface */
- unsigned int digger_radius_gfx_width;
-
- /** Height of the digger_radius_gfx surface */
- unsigned int digger_radius_gfx_height;
-
-public:
- Digger(Pingu*);
-
- ActionName get_type () const { return Actions::Digger; }
-
- bool have_something_to_dig ();
- void dig ();
-
- void draw (SceneContext& gc);
- void update ();
-
-private:
- Digger (const Digger&);
- Digger& operator= (const Digger&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/drown.cpp (from rev 2685,
branches/pingus_sdl/src/actions/drown.cxx)
Deleted: branches/pingus_sdl/src/actions/drown.cxx
===================================================================
--- branches/pingus_sdl/src/actions/drown.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/drown.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,55 +0,0 @@
-// $Id: drown.cxx,v 1.15 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../math/vector3f.hpp"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../resource.hxx"
-#include "drown.hxx"
-
-namespace Actions {
-
-Drown::Drown (Pingu* p)
- : PinguAction(p)
-{
- sprite.load(Direction::LEFT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/drownfall/left"));
- sprite.load(Direction::RIGHT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/drownfall/right"));
-}
-
-void
-Drown::draw (SceneContext& gc)
-{
- gc.color().draw(sprite[pingu->direction], pingu->get_pos ());
-}
-
-void
-Drown::update ()
-{
- sprite[pingu->direction].update();
- if (sprite[pingu->direction].is_finished())
- {
- pingu->set_status(PS_DEAD);
- }
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/drown.hpp (from rev 2685,
branches/pingus_sdl/src/actions/drown.hxx)
Deleted: branches/pingus_sdl/src/actions/drown.hxx
===================================================================
--- branches/pingus_sdl/src/actions/drown.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/drown.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,52 +0,0 @@
-// $Id: drown.hxx,v 1.14 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_DROWN_HXX
-#define HEADER_PINGUS_ACTIONS_DROWN_HXX
-
-#include "../state_sprite.hxx"
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Drown : public PinguAction
-{
-private:
- StateSprite sprite;
-
-public:
- Drown (Pingu* p);
-
- ActionName get_type () const { return Actions::Drown; }
-
- void draw (SceneContext& gc);
- void update ();
-
- bool catchable () { return false; }
-
-private:
- Drown (const Drown&);
- Drown& operator= (const Drown&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/exiter.cpp (from rev 2685,
branches/pingus_sdl/src/actions/exiter.cxx)
Deleted: branches/pingus_sdl/src/actions/exiter.cxx
===================================================================
--- branches/pingus_sdl/src/actions/exiter.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/exiter.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,67 +0,0 @@
-// $Id: exiter.cxx,v 1.20 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../math/vector3f.hpp"
-#include "../display/scene_context.hxx"
-#include "../resource.hxx"
-#include "../pingu.hxx"
-#include "../sound/sound.hxx"
-#include "exiter.hxx"
-
-namespace Actions {
-
-Exiter::Exiter (Pingu* p)
- : PinguAction(p),
- sound_played(false)
-{
- sprite.load(Direction::LEFT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/exit/left"));
- sprite.load(Direction::RIGHT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/exit/right"));
-}
-
-void
-Exiter::update ()
-{
- sprite[pingu->direction].update();
-
- if (!sound_played)
- {
- sound_played = true;
- Sound::PingusSound::play_sound("yipee");
- }
-
- if (sprite[pingu->direction].is_finished())
- {
- if (pingu->get_status() != PS_EXITED)
- {
- pingu->set_status(PS_EXITED);
- }
- }
-}
-
-void
-Exiter::draw (SceneContext& gc)
-{
- gc.color().draw(sprite[pingu->direction], pingu->get_pos());
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/exiter.hpp (from rev 2685,
branches/pingus_sdl/src/actions/exiter.hxx)
Deleted: branches/pingus_sdl/src/actions/exiter.hxx
===================================================================
--- branches/pingus_sdl/src/actions/exiter.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/exiter.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,51 +0,0 @@
-// $Id: exiter.hxx,v 1.15 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_EXITER_HXX
-#define HEADER_PINGUS_ACTIONS_EXITER_HXX
-
-#include "../state_sprite.hxx"
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Exiter : public PinguAction
-{
-private:
- StateSprite sprite;
- bool sound_played;
-
-public:
- Exiter(Pingu*);
- void init(void);
- ActionName get_type() const { return Actions::Exiter; }
-
- void draw (SceneContext& gc);
- void update();
-
-private:
- Exiter (const Exiter&);
- Exiter& operator= (const Exiter&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/faller.cpp (from rev 2685,
branches/pingus_sdl/src/actions/faller.cxx)
Deleted: branches/pingus_sdl/src/actions/faller.cxx
===================================================================
--- branches/pingus_sdl/src/actions/faller.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/faller.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,177 +0,0 @@
-// $Id: faller.cxx,v 1.42 2004/03/27 14:19:08 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <math.h>
-#include "../col_map.hxx"
-#include "../colliders/pingu_collider.hxx"
-#include "../debug.hxx"
-#include "../globals.hxx"
-#include "../display/scene_context.hxx"
-#include "../movers/linear_mover.hxx"
-#include "../pingu.hxx"
-#include "../resource.hxx"
-#include "../world.hxx"
-#include "../worldobj.hxx"
-#include "faller.hxx"
-
- namespace Actions {
-
- Faller::Faller (Pingu* p)
- : PinguAction(p)
- {
- faller.load(Direction::LEFT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/faller/left"));
- faller.load(Direction::RIGHT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/faller/right"));
-
- tumbler.load(Direction::LEFT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/tumbler/left"));
- tumbler.load(Direction::RIGHT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/tumbler/right"));
- }
-
- Faller::~Faller () { }
-
- void
- Faller::update ()
- {
- tumbler[pingu->direction].update();
- faller[pingu->direction].update();
-
- // Pingu stands on ground
- if (rel_getpixel(0, -1) != Groundtype::GP_NOTHING)
- {
- pingu->set_action(Actions::Walker);
- return;
- }
-
- // FIXME: This should be triggered at a later point, when close to
- // FIXME: deadly_velocity or something like that. A translation
- // FIXME: animation for the floater might also help
- if (pingu->get_velocity().y > 5.0 && pingu->request_fall_action())
- return;
-
- // Apply gravity
- pingu->set_velocity(pingu->get_velocity()
- + Vector3f(0.0f, WorldObj::get_world()->get_gravity()) );
-
- Vector3f velocity = pingu->get_velocity();
- Vector3f move = velocity;
- bool collided;
-
- Movers::LinearMover mover(WorldObj::get_world(), pingu->get_pos());
-
- do
- {
- // Move the Pingu as far is it can go
- mover.update(move, Colliders::PinguCollider(pingu_height));
-
- pingu->set_pos(mover.get_pos());
-
- collided = mover.collided();
-
- // If the Pingu collided with something...
- if (collided)
- {
- move = mover.remaining();
-
- // If the Pingu collided into something while moving down...
- if (velocity.y > 0.0f
- && rel_getpixel(0, -2) != Groundtype::GP_NOTHING)
- {
- // Ping is on ground/water/something
- if ( rel_getpixel(0, -1) == Groundtype::GP_WATER
- || rel_getpixel(0, -1) == Groundtype::GP_LAVA)
- {
- pingu->set_action(Actions::Drown);
- }
- // Did we stop too fast?
- else if (fabs(pingu->get_velocity().y) > deadly_velocity)
- {
- pingu->set_action(Actions::Splashed);
- }
- else if (fabs(pingu->get_velocity().x) > deadly_velocity)
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Pingu: x Smashed on ground,
jumping" << std::endl;
- }
-
- break;
- }
- // If the Pingu collided into something while moving up...
- // NB: +1 because Mover backs out of something it has collided with.
- else if (velocity.y < 0.0f
- && rel_getpixel(0, pingu_height + 1) != Groundtype::GP_NOTHING)
- {
- // Don't make the Pingu go up any further.
- move.y = 0.0f;
- velocity.y = 0.0f;
- }
- else
- {
- // Make Pingu bounce off wall
- move.x = -(move.x / 3.0f);
- velocity.x = -(velocity.x / 3.0f);
-
- // Make the Pingu face the correct direction. NB: Pingu may
- // previously have been facing in the opposite direction of its
- // velocity because of an explosion.
- if (velocity.x > 0.0f)
- pingu->direction.right();
- else
- pingu->direction.left();
-
- pingu->set_velocity(velocity);
- break;
- }
- }
-
- // Update the Pingu's velocity
- pingu->set_velocity(velocity);
- }
- // Loop if the Pingu still needs to be moved
- while (collided);
- }
-
- void
- Faller::draw (SceneContext& gc)
- {
- if (is_tumbling()) {
- gc.color().draw(tumbler[pingu->direction], pingu->get_pos ());
- } else {
- gc.color().draw(faller[pingu->direction], pingu->get_pos ());
- }
- }
-
- bool
- Faller::is_tumbling () const
- {
- // If we are going fast enough to get smashed, start tumbling
- return ( fabs(pingu->get_velocity().x) > deadly_velocity
- || fabs(pingu->get_velocity().y) > deadly_velocity);
- }
-
- bool
- Faller::change_allowed (ActionName new_action)
- {
- return new_action == Actions::Floater || new_action == Actions::Climber;
- }
-
- } // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/faller.hpp (from rev 2685,
branches/pingus_sdl/src/actions/faller.hxx)
Deleted: branches/pingus_sdl/src/actions/faller.hxx
===================================================================
--- branches/pingus_sdl/src/actions/faller.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/faller.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,57 +0,0 @@
-// $Id: faller.hxx,v 1.21 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_FALLER_HXX
-#define HEADER_PINGUS_ACTIONS_FALLER_HXX
-
-#include "../state_sprite.hxx"
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Faller : public PinguAction
-{
-private:
- StateSprite faller;
- StateSprite tumbler;
-
- int falling;
-
-public:
- Faller(Pingu*);
- virtual ~Faller();
-
- void draw (SceneContext& gc);
- void update();
-
- bool change_allowed (Actions::ActionName new_action);
-
- ActionName get_type() const { return Actions::Faller; }
- bool is_tumbling () const;
-
-private:
- Faller (const Faller&);
- Faller& operator= (const Faller&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/floater.cpp (from rev 2685,
branches/pingus_sdl/src/actions/floater.cxx)
Deleted: branches/pingus_sdl/src/actions/floater.cxx
===================================================================
--- branches/pingus_sdl/src/actions/floater.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/floater.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,72 +0,0 @@
-// $Id: floater.cxx,v 1.25 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../resource.hxx"
-#include "../pingu.hxx"
-#include "../display/scene_context.hxx"
-#include "../groundtype.hxx"
-#include "floater.hxx"
-
-namespace Actions {
-
-Floater::Floater(Pingu* p)
- : PinguAction(p),
- falling_depth(0),
- step(0)
-{
- sprite = Resource::load_sprite("pingus/player" + pingu->get_owner_str() +
"/floater/left");
-}
-
-void
-Floater::update()
-{
- sprite.update ();
-
- pingu->set_velocity(Vector3f(0.0f, 1.0f));
-
- if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING)
- {
- ++step;
- if (step > 0)
- {
- pingu->set_y(pingu->get_y() + 1);
- step = 0;
- }
- }
- else
- {
- pingu->set_action (Actions::Walker);
- }
-}
-
-void
-Floater::draw (SceneContext& gc)
-{
- gc.color().draw(sprite, pingu->get_pos());
-}
-
-bool
-Floater::change_allowed (ActionName)
-{
- return false;
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/floater.hpp (from rev 2685,
branches/pingus_sdl/src/actions/floater.hxx)
Deleted: branches/pingus_sdl/src/actions/floater.hxx
===================================================================
--- branches/pingus_sdl/src/actions/floater.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/floater.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,57 +0,0 @@
-// $Id: floater.hxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_FLOATER_HXX
-#define HEADER_PINGUS_ACTIONS_FLOATER_HXX
-
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Floater : public PinguAction
-{
-private:
- int falling_depth;
- int step;
- Sprite sprite;
-
-public:
- Floater(Pingu* p);
-
- ActionName get_type() const { return Actions::Floater; }
- ActionType get_activation_mode() const { return FALL_TRIGGERED; }
-
- void init(void);
-
- void draw (SceneContext& gc);
- void update();
-
- char get_persistent_char () { return 'f'; }
- bool change_allowed (ActionName new_action);
-
-private:
- Floater (const Floater&);
- Floater& operator= (const Floater&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/jumper.cpp (from rev 2685,
branches/pingus_sdl/src/actions/jumper.cxx)
Deleted: branches/pingus_sdl/src/actions/jumper.cxx
===================================================================
--- branches/pingus_sdl/src/actions/jumper.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/jumper.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,60 +0,0 @@
-// $Id: jumper.cxx,v 1.21 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../math/vector3f.hpp"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../resource.hxx"
-#include "jumper.hxx"
-
-namespace Actions {
-
-Jumper::Jumper (Pingu* p)
- : PinguAction(p)
-{
- sprite.load(Direction::LEFT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/jumper/left"));
- sprite.load(Direction::RIGHT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/jumper/right"));
-}
-
-void
-Jumper::draw (SceneContext& gc)
-{
- gc.color().draw(sprite[pingu->direction], pingu->get_pos());
-}
-
-void
-Jumper::update ()
-{
- if (pingu->direction.is_right()) {
- pingu->set_velocity(pingu->get_velocity() + Vector3f(5.0, -5.0));
- } else {
- pingu->set_velocity(pingu->get_velocity() + Vector3f(-5.0, -5.0));
- }
-
- // Move the pingu in the air, so that it can start 'falling'
- pingu->set_y(pingu->get_y() - 1);
-
- pingu->set_action (Actions::Faller);
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/jumper.hpp (from rev 2685,
branches/pingus_sdl/src/actions/jumper.hxx)
Deleted: branches/pingus_sdl/src/actions/jumper.hxx
===================================================================
--- branches/pingus_sdl/src/actions/jumper.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/jumper.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,49 +0,0 @@
-// $Id: jumper.hxx,v 1.14 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_JUMPER_HXX
-#define HEADER_PINGUS_ACTIONS_JUMPER_HXX
-
-#include "../state_sprite.hxx"
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Jumper : public PinguAction
-{
-private:
- StateSprite sprite;
-public:
- Jumper(Pingu*);
-
- ActionName get_type() const { return Actions::Jumper; }
-
- void draw (SceneContext& gc);
- void update();
-
-private:
- Jumper (const Jumper&);
- Jumper& operator= (const Jumper&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/laser_kill.cpp (from rev 2685,
branches/pingus_sdl/src/actions/laser_kill.cxx)
Deleted: branches/pingus_sdl/src/actions/laser_kill.cxx
===================================================================
--- branches/pingus_sdl/src/actions/laser_kill.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/actions/laser_kill.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,52 +0,0 @@
-// $Id: laser_kill.cxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../math/vector3f.hpp"
-#include "../resource.hxx"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "laser_kill.hxx"
-
-namespace Actions {
-
-LaserKill::LaserKill(Pingu* p)
- : PinguAction(p)
-{
- sprite.load(Direction::LEFT,
Resource::load_sprite("other/laser_kill/left"));
- sprite.load(Direction::RIGHT,
Resource::load_sprite("other/laser_kill/right"));
-}
-
-void
-LaserKill::draw (SceneContext& gc)
-{
- gc.color().draw(sprite[pingu->direction], pingu->get_pos () + Vector3f (0,
2));
-}
-
-void
-LaserKill::update ()
-{
- if (sprite[pingu->direction].is_finished())
- pingu->set_status(PS_DEAD);
- else
- sprite[pingu->direction].update();
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/laser_kill.hpp (from rev 2685,
branches/pingus_sdl/src/actions/laser_kill.hxx)
Deleted: branches/pingus_sdl/src/actions/laser_kill.hxx
===================================================================
--- branches/pingus_sdl/src/actions/laser_kill.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/actions/laser_kill.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,55 +0,0 @@
-// $Id: laser_kill.hxx,v 1.15 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_LASER_KILL_HXX
-#define HEADER_PINGUS_ACTIONS_LASER_KILL_HXX
-
-#include "../state_sprite.hxx"
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-/** This action is triggered by the LaserExit trap and causes the
- pingu to 'burn-away' */
-class LaserKill : public PinguAction
-{
-private:
- StateSprite sprite;
-
-public:
- LaserKill (Pingu*);
-
- ActionName get_type () const { return Actions::Laserkill; }
- void init (void);
-
- void draw (SceneContext& gc);
- void update ();
-
- bool catchable () { return false; }
-
-private:
- LaserKill (const LaserKill&);
- LaserKill& operator= (const LaserKill&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/miner.cpp (from rev 2685,
branches/pingus_sdl/src/actions/miner.cxx)
Deleted: branches/pingus_sdl/src/actions/miner.cxx
===================================================================
--- branches/pingus_sdl/src/actions/miner.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/miner.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,96 +0,0 @@
-// $Id: miner.cxx,v 1.25 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../ground_map.hxx"
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../world.hxx"
-#include "../resource.hxx"
-#include "../sound/sound.hxx"
-#include "../pingu.hxx"
-#include "../worldobj.hxx"
-#include "miner.hxx"
-
-namespace Actions {
-
-Miner::Miner (Pingu* p)
- : PinguAction(p),
- miner_radius(Resource::load_collision_mask("other/bash_radius")),
- miner_radius_gfx(Resource::load_collision_mask("other/bash_radius_gfx")),
- slow_count(0)
-{
- sprite.load(Direction::LEFT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/miner/left"));
- sprite.load(Direction::RIGHT, Resource::load_sprite("pingus/player" +
- pingu->get_owner_str() + "/miner/right"));
-
- miner_radius_width = miner_radius.get_width();
- miner_radius_gfx_width = miner_radius_gfx.get_width();
-}
-
-void
-Miner::update ()
-{
- sprite[pingu->direction].update();
-
- ++slow_count;
- if (!(slow_count % 4))
- {
- if (!(slow_count % 3))
- {
- WorldObj::get_world()->remove(miner_radius,
- static_cast<int>(pingu->get_x() -
(miner_radius_width / 2) + pingu->direction),
- static_cast<int>(pingu->get_y() -
miner_radius_width + 1));
- }
-
- pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() + 1);
- }
-
- if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING)
- {
- WorldObj::get_world()->remove(miner_radius,
- static_cast<int>(pingu->get_x() -
(miner_radius_width / 2) + pingu->direction),
- static_cast<int>(pingu->get_y() -
miner_radius_width + 3) );
- pingu->set_action(Actions::Walker);
- }
- else if (rel_getpixel(0, -1) == Groundtype::GP_SOLID
- || rel_getpixel(0, pingu_height) == Groundtype::GP_SOLID)
- {
- if (rel_getpixel(0, -1) == Groundtype::GP_SOLID)
- Sound::PingusSound::play_sound("chink");
-
- WorldObj::get_world()->remove(miner_radius,
- static_cast<int>(pingu->get_x() -
(miner_radius_width / 2) + pingu->direction),
- static_cast<int>(pingu->get_y() -
miner_radius_width + 1) );
- pingu->set_action(Actions::Walker);
-
- // Stop Pingu walking further into the solid.
- pingu->direction.change();
- }
-}
-
-void
-Miner::draw (SceneContext& gc)
-{
- gc.color().draw(sprite[pingu->direction], pingu->get_pos());
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/miner.hpp (from rev 2685,
branches/pingus_sdl/src/actions/miner.hxx)
Deleted: branches/pingus_sdl/src/actions/miner.hxx
===================================================================
--- branches/pingus_sdl/src/actions/miner.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/miner.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,60 +0,0 @@
-// $Id: miner.hxx,v 1.15 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_MINER_HXX
-#define HEADER_PINGUS_ACTIONS_MINER_HXX
-
-#include "../pingu_action.hxx"
-#include "../state_sprite.hxx"
-
-namespace Actions {
-
-class Miner : public PinguAction
-{
-private:
- CollisionMask miner_radius;
- CollisionMask miner_radius_gfx;
- StateSprite sprite;
- int slow_count;
-
- /** Width of the miner_radius surface */
- unsigned int miner_radius_width;
-
- /** Width of the miner_radius_gfx surface */
- unsigned int miner_radius_gfx_width;
-
-public:
- Miner (Pingu* p);
- virtual ~Miner () {}
-
- ActionName get_type () const { return Actions::Miner; }
-
- void draw (SceneContext& gc);
- void update ();
-
-private:
- Miner (const Miner&);
- Miner& operator= (const Miner&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/rocket_launcher.cpp (from rev 2685,
branches/pingus_sdl/src/actions/rocket_launcher.cxx)
Deleted: branches/pingus_sdl/src/actions/rocket_launcher.cxx
===================================================================
--- branches/pingus_sdl/src/actions/rocket_launcher.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/actions/rocket_launcher.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,68 +0,0 @@
-// $Id: rocket_launcher.cxx,v 1.17 2003/10/22 11:11:23 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/scene_context.hxx"
-//#include "../particles/particle_holder.hxx"
-//#include "../particles/explosive_particle.hxx"
-#include "../world.hxx"
-#include "../resource.hxx"
-#include "../pingu.hxx"
-#include "../worldobj.hxx"
-#include "rocket_launcher.hxx"
-
-namespace Actions {
-
-RocketLauncher::RocketLauncher (Pingu* p)
- : PinguAction(p),
- launched(false)
-{
- sprite.load(Direction::LEFT, "pingus/player" + pingu->get_owner_str() +
- "/rocketlauncher/left");
- sprite.load(Direction::RIGHT, "pingus/player" + pingu->get_owner_str() +
- "/rocketlauncher/right");
-
-/* Explosive Particles not supported right now
- WorldObj::get_world()->get_particle_holder()->add_particle
- (new ExplosiveParticle (static_cast<int>(pingu->get_x()),
- static_cast<int>(pingu->get_y()) - 12,
- pingu->direction.is_left() ? -400.0f : 400.0f,
- 0.0f));
-*/
-}
-
-void
-RocketLauncher::update ()
-{
- if (sprite[pingu->direction].is_finished())
- {
- pingu->set_action(Actions::Walker);
- }
-
- sprite.update();
-}
-
-void
-RocketLauncher::draw (SceneContext& gc)
-{
- gc.color().draw(sprite[pingu->direction], pingu->get_pos());
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/rocket_launcher.hpp (from rev 2685,
branches/pingus_sdl/src/actions/rocket_launcher.hxx)
Deleted: branches/pingus_sdl/src/actions/rocket_launcher.hxx
===================================================================
--- branches/pingus_sdl/src/actions/rocket_launcher.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/actions/rocket_launcher.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,51 +0,0 @@
-// $Id: rocket_launcher.hxx,v 1.14 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_ROCKET_LAUNCHER_HXX
-#define HEADER_PINGUS_ACTIONS_ROCKET_LAUNCHER_HXX
-
-#include "../state_sprite.hxx"
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class RocketLauncher : public PinguAction
-{
-private:
- StateSprite sprite;
- bool launched;
-public:
- RocketLauncher(Pingu*);
- ~RocketLauncher() {}
-
- ActionName get_type () const { return Actions::Rocketlauncher; }
-
- void draw (SceneContext& gc);
- void update ();
-
-private:
- RocketLauncher (const RocketLauncher&);
- RocketLauncher& operator= (const RocketLauncher&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/slider.cpp (from rev 2685,
branches/pingus_sdl/src/actions/slider.cxx)
Deleted: branches/pingus_sdl/src/actions/slider.cxx
===================================================================
--- branches/pingus_sdl/src/actions/slider.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/slider.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,81 +0,0 @@
-// $Id: slider.cxx,v 1.20 2004/03/27 14:19:08 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../resource.hxx"
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "slider.hxx"
-
-namespace Actions {
-
-Slider::Slider (Pingu* p)
- : PinguAction(p),
- speed(10)
-{
- sprite.load(Direction::LEFT, "pingus/player" + pingu->get_owner_str() +
- "/slider/left");
- sprite.load(Direction::RIGHT, "pingus/player" + pingu->get_owner_str() +
- "/slider/right");
-}
-
-void
-Slider::update ()
-{
- sprite[pingu->direction].update();
-
- for (int i = 0; i < speed && rel_getpixel(1, 0) == Groundtype::GP_NOTHING;
++i)
- {
- pingu->set_x(pingu->get_x() + pingu->direction);
-
- if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING)
- {
- speed = (speed > 5) ? 5 : speed;
-
- if (pingu->direction.is_right())
- {
- pingu->set_velocity(pingu->get_velocity() + Vector3f(speed,
0.0));
- }
- else
- {
- pingu->set_velocity(pingu->get_velocity() + Vector3f(-speed,
0.0));
- }
-
- pingu->set_action(Actions::Walker);
- return;
- }
- }
-
- speed -= 7 * 0.025f;
- if (speed < 1)
- {
- pingu->set_action(Actions::Walker);
- return;
- }
-}
-
-void
-Slider::draw (SceneContext& gc)
-{
- gc.color().draw(sprite[pingu->direction], pingu->get_pos() + Vector3f(0,
-2));
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/slider.hpp (from rev 2685,
branches/pingus_sdl/src/actions/slider.hxx)
Deleted: branches/pingus_sdl/src/actions/slider.hxx
===================================================================
--- branches/pingus_sdl/src/actions/slider.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/slider.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,50 +0,0 @@
-// $Id: slider.hxx,v 1.14 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_SLIDER_HXX
-#define HEADER_PINGUS_ACTIONS_SLIDER_HXX
-
-#include "../state_sprite.hxx"
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Slider : public PinguAction
-{
-private:
- StateSprite sprite;
- float speed;
-public:
- Slider (Pingu* p);
-
- ActionName get_type() const { return Actions::Slider; }
-
- void draw (SceneContext& gc);
- void update();
-
-private:
- Slider (const Slider&);
- Slider& operator= (const Slider&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/smashed.cpp (from rev 2685,
branches/pingus_sdl/src/actions/smashed.cxx)
Deleted: branches/pingus_sdl/src/actions/smashed.cxx
===================================================================
--- branches/pingus_sdl/src/actions/smashed.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/smashed.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,52 +0,0 @@
-// $Id: smashed.cxx,v 1.15 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../resource.hxx"
-#include "../math/vector3f.hpp"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "smashed.hxx"
-
-namespace Actions {
-
-Smashed::Smashed (Pingu* p)
- : PinguAction(p),
- sound_played(false)
-{
- sprite = Resource::load_sprite("pingus/player" + pingu->get_owner_str() +
"/bomber");
-}
-
-void
-Smashed::draw (SceneContext& gc)
-{
- gc.color().draw(sprite, pingu->get_pos ());
-}
-
-void
-Smashed::update()
-{
- sprite.update();
- // pingu->particle->add_pingu_explo(pingu->x_pos, pingu->y_pos - 16);
- if (sprite.is_finished())
- pingu->set_status(PS_DEAD);
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/smashed.hpp (from rev 2685,
branches/pingus_sdl/src/actions/smashed.hxx)
Deleted: branches/pingus_sdl/src/actions/smashed.hxx
===================================================================
--- branches/pingus_sdl/src/actions/smashed.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/smashed.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,54 +0,0 @@
-// $Id: smashed.hxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_SMASHED_HXX
-#define HEADER_PINGUS_ACTIONS_SMASHED_HXX
-
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-/** FIXME: this action doesn't have a purpose, its pretty much equal
- to the new splashed action */
-class Smashed : public PinguAction
-{
-private:
- bool sound_played;
- Sprite sprite;
-
-public:
- Smashed (Pingu*);
-
- ActionName get_type () const { return Actions::Smashed; }
-
- void draw (SceneContext& gc);
- void update ();
-
- bool catchable () { return false; }
-
-private:
- Smashed (const Smashed&);
- Smashed& operator= (const Smashed&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/splashed.cpp (from rev 2685,
branches/pingus_sdl/src/actions/splashed.cxx)
Deleted: branches/pingus_sdl/src/actions/splashed.cxx
===================================================================
--- branches/pingus_sdl/src/actions/splashed.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/actions/splashed.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,63 +0,0 @@
-// $Id: splashed.cxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../resource.hxx"
-#include "../math/vector3f.hpp"
-#include "../display/scene_context.hxx"
-#include "../world.hxx"
-#include "../pingu.hxx"
-#include "../worldobj.hxx"
-#include "splashed.hxx"
-
-namespace Actions {
-
-Splashed::Splashed (Pingu* p)
- : PinguAction(p),
- particle_thrown(false),
- sound_played(false)
-{
- sprite = Resource::load_sprite("pingus/player" + pingu->get_owner_str() +
"/splat");
-}
-
-void
-Splashed::update ()
-{
- sprite.update();
-
- if (!particle_thrown)
- {
- particle_thrown = true;
- WorldObj::get_world()->play_sound("splash", pingu->get_pos());
- }
-
- if (sprite.is_finished())
- {
- pingu->set_status(PS_DEAD);
- }
-}
-
-void
-Splashed::draw (SceneContext& gc)
-{
- gc.color().draw(sprite, pingu->get_pos ());
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/splashed.hpp (from rev 2685,
branches/pingus_sdl/src/actions/splashed.hxx)
Deleted: branches/pingus_sdl/src/actions/splashed.hxx
===================================================================
--- branches/pingus_sdl/src/actions/splashed.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/actions/splashed.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,53 +0,0 @@
-// $Id: splashed.hxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_SPLASHED_HXX
-#define HEADER_PINGUS_ACTIONS_SPLASHED_HXX
-
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Splashed : public PinguAction
-{
-private:
- bool particle_thrown;
- bool sound_played;
- Sprite sprite;
-public:
- Splashed (Pingu*);
-
- ActionName get_type () const { return Actions::Splashed; }
-
- void draw (SceneContext& gc);
- void update ();
-
- bool catchable () { return false; }
- bool change_allowed (Actions::ActionName) { return false; }
-
-private:
- Splashed (const Splashed&);
- Splashed& operator= (const Splashed&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/superman.cpp (from rev 2685,
branches/pingus_sdl/src/actions/superman.cxx)
Deleted: branches/pingus_sdl/src/actions/superman.cxx
===================================================================
--- branches/pingus_sdl/src/actions/superman.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/actions/superman.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,54 +0,0 @@
-// $Id: superman.cxx,v 1.14 2003/10/22 11:11:23 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../resource.hxx"
-#include "superman.hxx"
-
-namespace Actions {
-
-Superman::Superman (Pingu* p)
- : PinguAction(p),
- counter(0.0f),
- x_pos(pingu->get_x()),
- sprite(Resource::load_sprite("pingus/player" + pingu->get_owner_str() +
"/superman"))
-{
-}
-
-void
-Superman::update ()
-{
- sprite.update();
- counter += 0.025f;
- pingu->set_pos(pingu->get_x() + 40.0f * 0.025f, pingu->get_y() - 200.0f *
0.025f);
-
- if (pingu->get_y() < -32)
- pingu->set_status(PS_DEAD);
-}
-
-void
-Superman::draw (SceneContext& gc)
-{
- gc.color().draw(sprite, pingu->get_pos ());
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/superman.hpp (from rev 2685,
branches/pingus_sdl/src/actions/superman.hxx)
Deleted: branches/pingus_sdl/src/actions/superman.hxx
===================================================================
--- branches/pingus_sdl/src/actions/superman.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/actions/superman.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,51 +0,0 @@
-// $Id: superman.hxx,v 1.15 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_SUPERMAN_HXX
-#define HEADER_PINGUS_ACTIONS_SUPERMAN_HXX
-
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Superman : public PinguAction
-{
-private:
- double counter;
- double x_pos;
- Sprite sprite;
-
-public:
- Superman (Pingu*);
-
- ActionName get_type () const { return Actions::Superman; }
-
- void draw (SceneContext& gc);
- void update ();
-
-private:
- Superman (const Superman&);
- Superman& operator= (const Superman&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/teleported.cpp (from rev 2685,
branches/pingus_sdl/src/actions/teleported.cxx)
Deleted: branches/pingus_sdl/src/actions/teleported.cxx
===================================================================
--- branches/pingus_sdl/src/actions/teleported.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/actions/teleported.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,52 +0,0 @@
-// $Id: teleported.cxx,v 1.14 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../resource.hxx"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "teleported.hxx"
-
-namespace Actions {
-
-Teleported::Teleported(Pingu* p)
- : PinguAction(p),
- sound_played(false)
-{
- sprite = Resource::load_sprite("pingus/player" + pingu->get_owner_str() +
"/bomber");
-}
-
-
-void
-Teleported::draw (SceneContext& gc)
-{
- gc.color().draw(sprite, pingu->get_pos ());
-}
-
-
-void
-Teleported::update()
-{
- pingu->set_pos (x_target, y_target);
- pingu->set_status(PS_ALIVE);
- pingu->set_action(Actions::Walker);
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/teleported.hpp (from rev 2685,
branches/pingus_sdl/src/actions/teleported.hxx)
Deleted: branches/pingus_sdl/src/actions/teleported.hxx
===================================================================
--- branches/pingus_sdl/src/actions/teleported.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/actions/teleported.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,53 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_TELEPORTED_HXX
-#define HEADER_PINGUS_ACTIONS_TELEPORTED_HXX
-
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-class Teleported : public PinguAction
-{
-private:
- //bool particle_thrown;
- bool sound_played;
- Sprite sprite;
-
-public:
- Teleported (Pingu*);
-
- ActionName get_type() const { return Actions::Teleported; }
-
- void draw (SceneContext& gc);
- void update();
-
- bool catchable () { return false; }
-
- int x_target, y_target; // <- FIXME: Ugly!
-
-private:
- Teleported (const Teleported&);
- Teleported& operator= (const Teleported&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/waiter.cpp (from rev 2685,
branches/pingus_sdl/src/actions/waiter.cxx)
Deleted: branches/pingus_sdl/src/actions/waiter.cxx
===================================================================
--- branches/pingus_sdl/src/actions/waiter.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/waiter.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,54 +0,0 @@
-// $Id: waiter.cxx,v 1.18 2003/10/22 11:11:23 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../math/vector3f.hpp"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../resource.hxx"
-#include "waiter.hxx"
-
-namespace Actions {
-
-Waiter::Waiter (Pingu* p)
- : PinguAction(p),
- countdown(2.0f)
-{
- sprite = Resource::load_sprite("pingus/player" + pingu->get_owner_str() +
"/waiter/left");
-}
-
-void
-Waiter::update ()
-{
- sprite.update();
-
- if (countdown < 0)
- pingu->set_action(Actions::Walker);
-
- countdown -= 0.025f;
-}
-
-void
-Waiter::draw (SceneContext& gc)
-{
- gc.color().draw(sprite, pingu->get_pos ());
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/waiter.hpp (from rev 2685,
branches/pingus_sdl/src/actions/waiter.hxx)
Deleted: branches/pingus_sdl/src/actions/waiter.hxx
===================================================================
--- branches/pingus_sdl/src/actions/waiter.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/waiter.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,53 +0,0 @@
-// $Id: waiter.hxx,v 1.15 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_WAITER_HXX
-#define HEADER_PINGUS_ACTIONS_WAITER_HXX
-
-#include "../pingu_action.hxx"
-
-namespace Actions {
-
-/** A Waiting action for the bridger, it gets activated when the
- bridger is out of bridges. It then waits two seconds (meanwhile doing a
- funny animation) and then he changes back to a normal walker. */
-class Waiter : public PinguAction
-{
-private:
- float countdown;
- Sprite sprite;
-
-public:
- Waiter (Pingu*);
-
- ActionName get_type () const { return Actions::Waiter; }
-
- void draw (SceneContext& gc);
- void update ();
-
-private:
- Waiter (const Waiter&);
- Waiter& operator= (const Waiter&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/walker.cpp (from rev 2685,
branches/pingus_sdl/src/actions/walker.cxx)
Deleted: branches/pingus_sdl/src/actions/walker.cxx
===================================================================
--- branches/pingus_sdl/src/actions/walker.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/walker.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,217 +0,0 @@
-// $Id: walker.cxx,v 1.34 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../col_map.hxx"
-#include "../globals.hxx"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../debug.hxx"
-#include "walker.hxx"
-
-namespace Actions {
-
-Walker::Walker (Pingu* p)
- : PinguAction(p)
-{
- walker.load(Direction::LEFT, "pingus/player" + pingu->get_owner_str() +
"/walker/left");
- walker.load(Direction::RIGHT, "pingus/player" + pingu->get_owner_str() +
"/walker/right");
-
- floaterlayer.load(Direction::LEFT, "other/floaterlayer/left");
- floaterlayer.load(Direction::RIGHT, "other/floaterlayer/right");
-
- // Reset the velocity
- pingu->set_velocity(Vector3f());
-}
-
-void
-Walker::update ()
-{
- // update the sprite
- walker[pingu->direction].update(0.033);
- floaterlayer[pingu->direction].update(0.033);
-
- Vector3f last_pos = pingu->get_pos();
-
- /* How should this code work?
-
- 1) Check that the Pingu stands still on ground, if not turn it into
- a faller or drown. The reason we do so, is that we catch situations
- where a digger or a similar action removed the ground under the
- walker.
-
- 2) If pingu is still on ground, we can preprare the next step
-
- 3) Check if up-hill or down-hill is required
-
-
- 4)
-
- */
-
- if (rel_getpixel(0, -1) == Groundtype::GP_WATER)
- {
- pingu->set_action(Actions::Drown);
- return;
- }
-
- // The Pingu stands no longer on ground, the cause for this could be
- // a digger, miner or a bomber
- if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING)
- {
- // We search for the nearest ground below the pingu, if we can't
- // find anything within a few pixels, we will turn into a faller
- bool found_ground = false;
- int i;
- for (i = -2; i > -5; --i)
- {
- if (!(rel_getpixel(0, i) == Groundtype::GP_NOTHING))
- {
- found_ground = true;
- break;
- }
- }
-
- if (found_ground)
- {
- pingu->set_y(pingu->get_y() - i);
- }
- else
- {
- pingu->set_action(Actions::Faller);
- return;
- }
- }
-
-
- // FIXME: here we could/should scan more pixels
- if (rel_getpixel(1, 0) == Groundtype::GP_BRIDGE
- && !head_collision_on_walk(1, 1)) // bridge
- {
- // simple, stupid, but working bridge code
- // FIXME: We don't check if we 'drift' into a solid ground block
- pingu->set_pos(pingu->get_x() + pingu->direction,
- pingu->get_y() - 1); // pingus 'float' through bridges
- }
- else
- {
- // Non of the trivial moves worked, so we do up-hill or down-hill walking
- // FIXME: currently the pingu takes multiple steps at once when
- // FIXME: working uphill, this looks kind of ugly
-
-
- // FIXME: rel_getpixel works on the current pos, so modifing pos
- // FIXME: is evil, a backup copy might help
-
- // if infront is a pixel
- // Pingu is walking up the mountain
- // we can continue walking up. search for the correct y_pos
- int y_inc = 0;
- int possible_y_step = 0;
- bool found_next_step = false;
- for (y_inc = -max_steps; y_inc <= max_steps; ++y_inc)
- {// up/down-hill scan
- if (( rel_getpixel(1, y_inc) == Groundtype::GP_NOTHING
- || rel_getpixel(1, y_inc) == Groundtype::GP_BRIDGE) //
FIXME: This causes a rather huge step
- && rel_getpixel(1, y_inc - 1) != Groundtype::GP_NOTHING)
- { // FIXME:
- found_next_step = true;
- possible_y_step = y_inc;
- // No break here, since we always want to use the highest
possible position
- //break;
- }
- }
-
- if (found_next_step)
- {
- // pos.y has a reversed co-system to rel_getpixel()?
- pingu->set_pos(pingu->get_x() + pingu->direction,
- pingu->get_y() - possible_y_step);
- }
- else
- {
- if (rel_getpixel(1, 0) != Groundtype::GP_NOTHING)
- {
- // We reached a wall
- if (pingu->request_wall_action())
- {
- pout(PINGUS_DEBUG_ACTIONS)
- << "Pingu: We are in front of a wall, setting persistant
action" << std::endl;
- return;
- }
-
- // No persitent action found, so change the direction
- pingu->direction.change();
- }
- else
- {
- // We take the step, so that we are in the air
- pingu->set_x(pingu->get_x() + pingu->direction);
- // We reached a cliff
- pingu->set_action(Actions::Faller);
- return;
- }
- }
- }
-
-
- // This is moved here to fix the bug where pingu stuck turning both
- // sides indefinetely when a head collision occured. the fix needs the
- // above downhill walk being done before head collision check.
- if (head_collision_on_walk(0, 0))
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Pingu: Head collision" << std::endl;
-
- //if the new position causes a head collision, we are already
- //stuck in a wall, so lets go back to the old position
- pingu->direction.change();
- pingu->set_pos(last_pos);
- return;
- }
-
- /*
- for(int y_inc=1; y_inc <= max_steps; ++y_inc)
- {
- if (rel_getpixel(1, -y_inc) == ColMap::WATER)
- {
- pingu->set_paction ("drown");
- return;
- }
- else if(rel_getpixel(1, -y_inc) != ColMap::NOTHING)
- { // there is land
- pingu->pos.y += y_inc - 1;
- break;
- }
- }
- */
-}
-
-void
-Walker::draw (SceneContext& gc)
-{
- gc.color().draw(walker[pingu->direction], pingu->get_pos());
-
- if (pingu->get_fall_action() && pingu->get_fall_action()->get_type() ==
Actions::Floater)
- {
- gc.color().draw(floaterlayer[pingu->direction], pingu->get_pos());
- }
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/actions/walker.hpp (from rev 2685,
branches/pingus_sdl/src/actions/walker.hxx)
Deleted: branches/pingus_sdl/src/actions/walker.hxx
===================================================================
--- branches/pingus_sdl/src/actions/walker.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/actions/walker.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,53 +0,0 @@
-// $Id: walker.hxx,v 1.15 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTIONS_WALKER_HXX
-#define HEADER_PINGUS_ACTIONS_WALKER_HXX
-
-#include "../pingu_action.hxx"
-#include "../state_sprite.hxx"
-
-namespace Actions {
-
-class Walker : public PinguAction
-{
-private:
- StateSprite walker;
- StateSprite floaterlayer;
-
- enum { max_steps = 5 }; // max nr. of pixels that pingu can walk up/down
-
-public:
- Walker (Pingu*);
-
- void draw (SceneContext& gc);
- void update ();
-
- ActionName get_type () const { return Actions::Walker; }
-
-private:
- Walker (const Walker&);
- Walker& operator= (const Walker&);
-};
-
-} // namespace Actions
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/blitter.cpp (from rev 2685,
branches/pingus_sdl/src/blitter.cxx)
Deleted: branches/pingus_sdl/src/blitter.cxx
===================================================================
--- branches/pingus_sdl/src/blitter.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/blitter.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,676 +0,0 @@
-// $Id: blitter.cxx,v 1.34 2003/10/21 21:37:05 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <ClanLib/Core/System/clanstring.h>
-#include <ClanLib/Core/IOData/cl_endian.h>
-#include <ClanLib/Core/IOData/datatypes.h>
-#include <ClanLib/Display/palette.h>
-#include <ClanLib/Display/pixel_buffer.h>
-#include <ClanLib/Display/pixel_format.h>
-
-#include "pingus_error.hxx"
-#include "globals.hxx"
-#include "math.hxx"
-#include "blitter.hxx"
-#include "debug.hxx"
-#include "blitter_impl.hxx"
-
-/* Headers needed for i18n / gettext */
-#include "gettext.h"
-
-void
-Blitter::put_surface(PixelBuffer canvas, const CL_Surface& sur,
- int x, int y)
-{
- Blitter::put_surface(canvas, sur.get_pixeldata(), x, y);
-}
-
-void
-Blitter::put_surface(PixelBuffer canvas, PixelBuffer provider,
- int x, int y)
-{
- switch(provider.get_format().get_depth())
- {
- case 8:
- put_surface_8bit(canvas, provider, x, y);
- break;
- case 32:
- put_surface_32bit(canvas, provider, x, y);
- break;
- default:
- PingusError::raise("Blitter:put_surface:Unknown color depth: " +
CL_String::to(provider.get_format().get_depth()));
- break;
- }
-}
-
-void
-Blitter::put_surface_8bit(PixelBuffer target, PixelBuffer source,
- int x_pos, int y_pos)
-{
- //std::cout << "8bit blit" << std::endl;
-
- assert(target.get_format().get_depth() == 32);
-
- target.lock();
- source.lock();
-
- int swidth = source.get_width();
- int twidth = target.get_width();
-
- int start_x = std::max(0, -x_pos);
- int start_y = std::max(0, -y_pos);
-
- int end_x = std::min(swidth, twidth - x_pos);
- int end_y = std::min(source.get_height(), target.get_height() - y_pos);
-
- if (end_x - start_x <= 0 || end_y - start_y <= 0)
- return;
-
- cl_uint8* target_buf = static_cast<cl_uint8*>(target.get_data());
- cl_uint8* source_buf = static_cast<cl_uint8*>(source.get_data());
-
- CL_Palette palette = source.get_palette();
-
- if (source.get_format().has_colorkey())
- {
- unsigned int colorkey = source.get_format().get_colorkey();
-
- for (int y = start_y; y < end_y; ++y)
- {
- cl_uint8* tptr = target_buf + 4*((twidth*(y+y_pos)) + x_pos +
start_x);
- cl_uint8* sptr = source_buf + swidth*y + start_x;
-
- for (int x = start_x; x < end_x; ++x)
- {
- if (*sptr != colorkey)
- {
- if (!CL_Endian::is_system_big())
- {
- tptr[0] = 255;
- tptr[1] = palette.colors[*sptr].get_blue();
- tptr[2] = palette.colors[*sptr].get_green();
- tptr[3] = palette.colors[*sptr].get_red();
- }
- else
- {
- tptr[3] = 255;
- tptr[2] = palette.colors[*sptr].get_blue();
- tptr[1] = palette.colors[*sptr].get_green();
- tptr[0] = palette.colors[*sptr].get_red();
- }
- }
-
- tptr += 4;
- sptr += 1;
- }
- }
- }
- else
- {
- for (int y = start_y; y < end_y; ++y)
- {
- cl_uint8* tptr = target_buf + 4*((twidth*(y+y_pos)) + x_pos +
start_x);
- cl_uint8* sptr = source_buf + swidth*y + start_x;
-
- for (int x = start_x; x < end_x; ++x)
- {
- if (!CL_Endian::is_system_big())
- {
- tptr[0] = 255;
- tptr[1] = palette.colors[*sptr].get_blue();
- tptr[2] = palette.colors[*sptr].get_green();
- tptr[3] = palette.colors[*sptr].get_red();
- }
- else
- {
- tptr[3] = 255;
- tptr[2] = palette.colors[*sptr].get_blue();
- tptr[1] = palette.colors[*sptr].get_green();
- tptr[0] = palette.colors[*sptr].get_red();
- }
-
- tptr += 4;
- sptr += 1;
- }
- }
- }
-
- source.unlock();
- target.unlock();
-}
-
-void
-Blitter::put_surface_32bit(PixelBuffer target, PixelBuffer source,
- const int x_pos, const int y_pos)
-{
- //std::cout << "32bit blit" << std::endl;
-
- target.lock();
- source.lock();
-
- int swidth = source.get_width();
- int sheight = source.get_height();
-
- int twidth = target.get_width();
- int theight = target.get_height();
-
- int start_x = std::max(0, -x_pos);
- int start_y = std::max(0, -y_pos);
-
- int end_x = std::min(swidth, twidth - x_pos);
- int end_y = std::min(sheight, theight - y_pos);
-
- if (end_x - start_x <= 0
- || end_y - start_y <= 0)
- return;
-
- /* Benchmarks:
- * ===========
- * 6msec with memcpy
- * 10msec with uint32
- * 17msec with uint8
- */
-
- cl_uint8* target_buf = static_cast<cl_uint8*>(target.get_data());
- cl_uint8* source_buf = static_cast<cl_uint8*>(source.get_data());
-
- for (int y = start_y; y < end_y; ++y)
- {
- int tidx = 4*(twidth * (y_pos + y) + x_pos);
- int sidx = 4*(swidth * y);
-
- /*
- if (0)
- { // Fast but doesn't handle masks
- memcpy(target_buf + tidx + 4*start_x, source_buf + sidx + 4*start_x,
- sizeof(cl_uint32)*(end_x - start_x));
- }
- else if (0)
- { // doesn't handle masks either, but looks half correct
- cl_uint8* tptr = target_buf + tidx + 4*start_x;
- cl_uint8* sptr = source_buf + sidx + 4*start_x;
-
- for (int x = start_x; x < end_x; ++x)
- {
- if (!CL_Endian::is_system_big())
- {
- tptr[0] = sptr[3];
- tptr[1] = sptr[0];
- tptr[2] = sptr[1];
- tptr[3] = sptr[2];
- }
- else
- {
- tptr[3] = sptr[3];
- tptr[2] = sptr[0];
- tptr[1] = sptr[1];
- tptr[0] = sptr[2];
- }
-
- tptr += 4;
- sptr += 4;
- }
- }
- else */
- {
- // doesn't handle masks either, but looks half correct
- cl_uint8* tptr = target_buf + tidx + 4*start_x;
- cl_uint8* sptr = source_buf + sidx + 4*start_x;
-
- for (int x = start_x; x < end_x; ++x)
- {
- if (!CL_Endian::is_system_big())
- {
- float a =
sptr[0]/255.0f;
- tptr[0] = Math::mid(0, int((1.0f - a) * tptr[0] + a *
sptr[0]), 255);
- tptr[1] = Math::mid(0, int((1.0f - a) * tptr[1] + a *
sptr[1]), 255);
- tptr[2] = Math::mid(0, int((1.0f - a) * tptr[2] + a *
sptr[2]), 255);
- tptr[3] = Math::mid(0, int((1.0f - a) * tptr[3] + a *
sptr[3]), 255);
- }
- else
- {
- float a = sptr[3]/255.0f;
- tptr[3] = Math::mid(0, int((1.0f - a) * tptr[3] + a *
sptr[3]), 255);
- tptr[2] = Math::mid(0, int((1.0f - a) * tptr[2] + a *
sptr[0]), 255);
- tptr[1] = Math::mid(0, int((1.0f - a) * tptr[1] + a *
sptr[1]), 255);
- tptr[0] = Math::mid(0, int((1.0f - a) * tptr[0] + a *
sptr[2]), 255);
- }
-
- tptr += 4;
- sptr += 4;
- }
- }
- }
-
- source.unlock();
- target.unlock();
-}
-
-void
-Blitter::fill_rect(PixelBuffer target, const CL_Rect& rect, const Color& color)
-{
- if (target.get_format().get_depth() != 32
- && target.get_format().get_depth() != 24)
- {
- std::cout << "Blitter::fill_rect: depth must be 32 but is " <<
target.get_format().get_depth() << std::endl;
- return;
- }
-
- target.lock();
-
- int twidth = target.get_width();
- int swidth = rect.get_width();
-
- int start_x = std::max(0, -rect.left);
- int start_y = std::max(0, -rect.top);
-
- int end_x = std::min(swidth, twidth - rect.left);
- int end_y = std::min(rect.get_height(), target.get_height() - rect.top);
-
- if (end_x - start_x <= 0 || end_y - start_y <= 0)
- return;
-
- cl_uint8* target_buf = static_cast<cl_uint8*>(target.get_data());
-
- if (target.get_format().get_depth() == 24)
- {
- if (color.get_alpha() == 255)
- {
- for (int y = start_y; y < end_y; ++y)
- {
- cl_uint8* tptr = target_buf + 3*((twidth*(y + rect.top)) +
rect.left + start_x);
-
- for (int x = start_x; x < end_x; ++x)
- {
- if (!CL_Endian::is_system_big())
- {
- tptr[0] = color.get_red();
- tptr[1] = color.get_green();
- tptr[2] = color.get_blue();
- }
- else
- {
- tptr[2] = color.get_red();
- tptr[1] = color.get_green();
- tptr[0] = color.get_blue();
- }
- tptr += 3;
- }
- }
- }
- else
- {
- float a = color.get_alpha()/255.0f;
-
- for (int y = start_y; y < end_y; ++y)
- {
- cl_uint8* tptr = target_buf + 3*((twidth*(y + rect.top)) +
rect.left + start_x);
-
- for (int x = start_x; x < end_x; ++x)
- {
- if (!CL_Endian::is_system_big())
- {
- tptr[0] = Math::mid(0, int(((1.0f - a) * (tptr[0])) + a *
color.get_blue()) , 255); //blue
- tptr[1] = Math::mid(0, int(((1.0f - a) * (tptr[1])) + a *
color.get_green()), 255); //green
- tptr[2] = Math::mid(0, int(((1.0f - a) * (tptr[2])) + a *
color.get_red()), 255); //red
- }
- else
- {
- tptr[2] = Math::mid(0, int(((1.0f - a) * (tptr[2])) + a *
color.get_blue()) , 255); //blue
- tptr[1] = Math::mid(0, int(((1.0f - a) * (tptr[1])) + a *
color.get_green()), 255); //green
- tptr[0] = Math::mid(0, int(((1.0f - a) * (tptr[0])) + a *
color.get_red()), 255); //red
- }
-
- tptr += 3;
- }
- }
- }
- }
- else if (target.get_format().get_depth() == 32)
- {
- if (color.get_alpha() == 255)
- {
- for (int y = start_y; y < end_y; ++y)
- {
- cl_uint8* tptr = target_buf + 4*((twidth*(y + rect.top)) +
rect.left + start_x);
-
- for (int x = start_x; x < end_x; ++x)
- {
- if (!CL_Endian::is_system_big())
- {
- tptr[0] = 255;
- tptr[1] = color.get_blue();
- tptr[2] = color.get_green();
- tptr[3] = color.get_red();
- }
- else
- {
- tptr[3] = 255;
- tptr[2] = color.get_blue();
- tptr[1] = color.get_green();
- tptr[0] = color.get_red();
- }
- tptr += 4;
- }
- }
- }
- else
- {
- for (int y = start_y; y < end_y; ++y)
- {
- cl_uint8* tptr = target_buf + 4*((twidth*(y + rect.top)) +
rect.left + start_x);
-
- for (int x = start_x; x < end_x; ++x)
- {
- float a = color.get_alpha()/255.0f;
-
- if (!CL_Endian::is_system_big())
- {
- tptr[0] = Math::mid(0, int(tptr[0] + a *
color.get_alpha()), 255);
- tptr[1] = Math::mid(0, int((1.0f - a) * tptr[1] + a *
color.get_blue()) , 255);
- tptr[2] = Math::mid(0, int((1.0f - a) * tptr[2] + a *
color.get_green()), 255);
- tptr[3] = Math::mid(0, int((1.0f - a) * tptr[3] + a *
color.get_red()) , 255);
- }
- else
- {
- tptr[3] = Math::mid(0, int(tptr[3] + a *
color.get_alpha()), 255);
- tptr[2] = Math::mid(0, int((1.0f - a) * tptr[2] + a *
color.get_blue()) , 255);
- tptr[1] = Math::mid(0, int((1.0f - a) * tptr[1] + a *
color.get_green()), 255);
- tptr[0] = Math::mid(0, int((1.0f - a) * tptr[0] + a *
color.get_red()) , 255);
- }
- }
- }
- }
- }
-
- target.unlock();
-}
-
-void
-Blitter::clear_canvas(PixelBuffer canvas, Color color)
-{
- unsigned char* buffer;
-
- canvas.lock();
- buffer = static_cast<unsigned char*>(canvas.get_data());
- memset(buffer, color.color, sizeof(unsigned char) * canvas.get_pitch() *
canvas.get_height());
- canvas.unlock();
-}
-
-PixelBuffer
-Blitter::create_canvas(const CL_Surface& sur)
-{
- return create_canvas(sur.get_pixeldata());
-}
-
-PixelBuffer
-Blitter::create_canvas(PixelBuffer prov)
-{
- PixelBuffer canvas(prov.get_width(), prov.get_height(), prov.get_width()*4,
CL_PixelFormat::rgba8888);
-
- switch (prov.get_format().get_depth())
- {
- // RGB888
- case 24:
- {
- canvas.lock();
- prov.lock();
-
- int buffer_size = prov.get_pitch () * prov.get_height ();
- unsigned char* sbuffer = static_cast<unsigned char*>(prov.get_data ());
- unsigned char* tbuffer = static_cast<unsigned char*>(canvas.get_data
());
-
- for (int si = 0, ti = 0; si < buffer_size; si += 3, ti += 4)
- {
- if (!CL_Endian::is_system_big())
- {
- tbuffer[ti + 0] = 255; // Alpha
- tbuffer[ti + 1] = sbuffer[si + 0];
- tbuffer[ti + 2] = sbuffer[si + 1];
- tbuffer[ti + 3] = sbuffer[si + 2];
- }
- else
- {
- tbuffer[ti + 3] = 255; // Alpha
- tbuffer[ti + 2] = sbuffer[si + 0];
- tbuffer[ti + 1] = sbuffer[si + 1];
- tbuffer[ti + 0] = sbuffer[si + 2];
- }
- }
-
- // -FIXME: memory hole
- prov.unlock();
- canvas.unlock();
- }
- break;
-
- // RGBA8888
- case 32:
- canvas.lock();
- prov.lock();
- memcpy(canvas.get_data(), prov.get_data(),
- sizeof(unsigned char) * prov.get_height() * prov.get_pitch());
- prov.unlock();
- canvas.unlock();
- break;
-
- default:
- put_surface(canvas, prov, 0, 0);
- break;
- }
- return canvas;
-}
-
-CL_Surface
-Blitter::scale_surface (const CL_Surface& sur, int width, int height)
-{
- PixelBuffer buf = Blitter::scale_surface_to_canvas(sur, width, height);
- return CL_Surface(PixelBuffer(buf));
-}
-
-PixelBuffer
-Blitter::scale_surface_to_canvas (PixelBuffer provider, int width, int height)
-{
- PixelBuffer canvas(width, height, width*4, CL_PixelFormat::rgba8888);
-
- provider.lock ();
- canvas.lock ();
-
- unsigned char* sbuffer = static_cast<unsigned char*>(provider.get_data ());
- unsigned char* tbuffer = static_cast<unsigned char*>(canvas.get_data ());
- int pwidth = provider.get_width ();
- int pheight = provider.get_height ();
- int pitch = provider.get_pitch();
-
- if (provider.get_format().get_type() == pixelformat_index)
- {
- Color color;
- pout(PINGUS_DEBUG_ACTIONS) <<
- "Blitter::scale_surface_to_canvas() - Scaling indexed
image" << std::endl;
-
- for (int y = 0; y < height; ++y)
- for (int x = 0; x < width; ++x)
- {
- unsigned offset = (y * pheight/height) * pitch
+ (x * pwidth/width);
-
- color =
provider.get_palette().colors[sbuffer[offset]];
-
- // Detrmine alpha channel
- if (provider.get_format().has_colorkey()
- && provider.get_format().get_colorkey()
== sbuffer[offset])
- color.set_alpha(0);
- else
- color.set_alpha(255);
-
- canvas.draw_pixel(x, y, color);
- }
- }
- else
- {
- switch (provider.get_format().get_depth())
- {
- case 24:
- {
- // We assume that we have the data in RGB888, which might not be
- // the case
- pout(PINGUS_DEBUG_ACTIONS) <<
- "Blitter::scale_surface_to_canvas() - Scaling 24 bit image" <<
std::endl;
- for (int y = 0; y < height; ++y)
- for (int x = 0; x < width; ++x)
- {
- int ti = (y * width + x) * 4;
- int si = ((y * pheight / height) * pwidth
- + (x * pwidth / width)) * 3;
-
- if (!CL_Endian::is_system_big())
- {
- tbuffer[ti + 0] = 255; // alpha
- tbuffer[ti + 1] = sbuffer[(si + 0)]; // blue
- tbuffer[ti + 2] = sbuffer[(si + 1)]; // green
- tbuffer[ti + 3] = sbuffer[(si + 2)]; // red
- }
- else
- {
- tbuffer[ti + 3] = 255; // alpha
- tbuffer[ti + 0] = sbuffer[(si + 0)]; // blue
- tbuffer[ti + 1] = sbuffer[(si + 1)]; // green
- tbuffer[ti + 2] = sbuffer[(si + 2)]; // red
- }
- }
- }
- break;
- case 32:
- {
- // We assume that we have the data in RGBA8888, which might not be
- // the case
- pout(PINGUS_DEBUG_ACTIONS) <<
- "Blitter::scale_surface_to_canvas() - Scaling 32 bit
image" << std::endl;
-
- for (int y = 0; y < height; ++y)
- for (int x = 0; x < width; ++x)
- {
- int ti = (y * width + x) * 4;
- int si = ((y * pheight / height) * pwidth
- + (x * pwidth / width)) * 4;
-
- if (!CL_Endian::is_system_big())
- {
- tbuffer[ti + 0] = sbuffer[(si + 0)]; // alpha
- tbuffer[ti + 1] = sbuffer[(si + 1)]; // blue
- tbuffer[ti + 2] = sbuffer[(si + 2)]; // green
- tbuffer[ti + 3] = sbuffer[(si + 3)]; // red
- }
- else
- {
- tbuffer[ti + 3] = sbuffer[(si + 0)]; // alpha
- tbuffer[ti + 2] = sbuffer[(si + 1)]; // blue
- tbuffer[ti + 1] = sbuffer[(si + 2)]; // green
- tbuffer[ti + 0] = sbuffer[(si + 3)]; // red
- }
- }
- }
- break;
- default:
- // Slow but generic, using get_data () would be better, but
would
- // require quite a bit of work
- pout(PINGUS_DEBUG_ACTIONS) <<
- "Blitter::scale_surface_to_canvas() - Scaling image
using default method"
- << std::endl;
-
- for (int y = 0; y < height; ++y)
- for (int x = 0; x < width; ++x)
- {
- Color color = provider.get_pixel(x * pwidth /
width,
- y * pheight / height);
- // FIXME: ignoring the source alpha due to
get_pixel
- // brokeness... no time to test the patch
- canvas.draw_pixel(x, y, color);
- }
- break;
- }
- }
-
- canvas.unlock ();
- provider.unlock ();
-
- return canvas;
-}
-
-PixelBuffer
-Blitter::scale_surface_to_canvas(const CL_Surface& sur, int width, int height)
-{
- return Blitter::scale_surface_to_canvas(sur.get_pixeldata(), width, height);
-}
-
-/** Flip a surface horizontal */
-PixelBuffer
-Blitter::flip_horizontal (PixelBuffer prov)
-{
- return BlitterImpl::modify(prov, BlitterImpl::transform_flip());
-}
-
-/** Flip a surface vertical */
-PixelBuffer
-Blitter::flip_vertical (PixelBuffer sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot180_flip());
-}
-
-/** Rotate a surface 90 degrees */
-PixelBuffer
-Blitter::rotate_90 (PixelBuffer sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot90());
-}
-
-
-PixelBuffer
-Blitter::rotate_180 (PixelBuffer sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot180());
-}
-
-PixelBuffer
-Blitter::rotate_270 (PixelBuffer sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot270());
-}
-
-PixelBuffer
-Blitter::rotate_90_flip (PixelBuffer sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot90_flip());
-}
-
-PixelBuffer
-Blitter::rotate_180_flip (PixelBuffer sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot180_flip());
-}
-
-PixelBuffer
-Blitter::rotate_270_flip (PixelBuffer sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot270_flip());
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/blitter.hpp (from rev 2685,
branches/pingus_sdl/src/blitter.hxx)
Deleted: branches/pingus_sdl/src/blitter.hxx
===================================================================
--- branches/pingus_sdl/src/blitter.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/blitter.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,113 +0,0 @@
-// $Id: blitter.hxx,v 1.12 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_BLITTER_HXX
-#define HEADER_PINGUS_BLITTER_HXX
-
-#include "pingus.hxx"
-#include "math/color.hpp"
-#include "math/rect.hpp"
-////#include <ClanLib/Display/color.h>
-
-////class CL_Surface;
-class PixelBuffer;
-
-/** A bunch of blitting and creation functions to operate on
- PixelBuffer. Some of them a similar to the ones in ClanLib, but
- this are slower and work. */
-class Blitter
-{
-private:
- ///
- static void put_surface_8bit(PixelBuffer target, PixelBuffer source,
- int x, int y);
- ///
- static void put_surface_32bit(PixelBuffer target, PixelBuffer source,
- int x, int y);
-public:
- /** Puts a given surface to a given canvas at position x, y. */
- ////static void put_surface(PixelBuffer target, const CL_Surface& source,
- //// int x, int y);
-
- /** Puts a given surface provider to a given canvas at position x, y. */
- static void put_surface(PixelBuffer target, PixelBuffer source,
- int x, int y);
-
- /** Returns a newly allocated canvas. The canvas contains the same
- image as the given surface. */
- ////static PixelBuffer create_canvas(const CL_Surface&);
-
- /** Returns a newly allocated canvas. The canvas contains the same
- image as the given surface provider */
- static PixelBuffer create_canvas(PixelBuffer );
-
- /** Sets all pixels of a canvas to zero */
- static void clear_canvas(PixelBuffer, Color color = Color(0, 0, 0, 0));
-
- static void fill_rect(PixelBuffer target, const Rect& rect, const Color&
color);
-
- /** Creates a new surface (based on a canvas) with the given width
- and height and stretches the source surface onto it
-
- @param sur The source surface
- @param width The new width of the surface.
- @param height The new height of the surface.
- @return A newly created surface, the caller is responsible to delete it.
*/
- ////static CL_Surface scale_surface (const CL_Surface& sur, int width, int
height);
-
- /** Flip a surface horizontal */
- static PixelBuffer flip_horizontal (PixelBuffer sur);
-
- /** Flip a surface vertical */
- static PixelBuffer flip_vertical (PixelBuffer sur);
-
- /** Rotate a surface 90 degrees */
- static PixelBuffer rotate_90 (PixelBuffer sur);
-
- static PixelBuffer rotate_180 (PixelBuffer sur);
-
- static PixelBuffer rotate_270 (PixelBuffer sur);
-
- static PixelBuffer rotate_90_flip (PixelBuffer sur);
-
- static PixelBuffer rotate_180_flip (PixelBuffer sur);
-
- static PixelBuffer rotate_270_flip (PixelBuffer sur);
-
- /** Creates a new canvas with the given width and height and
- stretches the source surface onto it, the caller is responsible
- to delete the returned PixelBuffer.
-
- @param sur The source surface
- @param width The new width of the surface.
- @param height The new height of the surface.
- @return A newly created surface, the caller is responsible to delete it.
*/
- ////static PixelBuffer scale_surface_to_canvas (const CL_Surface& sur, int
width, int height);
-
- static PixelBuffer scale_surface_to_canvas (PixelBuffer sur, int width, int
height);
-
-private:
- Blitter (const Blitter&);
- Blitter& operator= (const Blitter&);
-};
-
-#endif
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/blitter_impl.hpp (from rev 2685,
branches/pingus_sdl/src/blitter_impl.hxx)
Deleted: branches/pingus_sdl/src/blitter_impl.hxx
===================================================================
--- branches/pingus_sdl/src/blitter_impl.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/blitter_impl.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,245 +0,0 @@
-// $Id: blitter_impl.hxx,v 1.16 2003/10/21 21:37:05 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_BLITTER_IMPL_HXX
-#define HEADER_PINGUS_BLITTER_IMPL_HXX
-
-#include <iostream>
-#include <ClanLib/Display/pixel_buffer.h>
-#include <ClanLib/Display/surface.h>
-#include "pingus.hxx"
-
-
-/** A collection of helper functions for the blitter class */
-namespace BlitterImpl
-{
-
-/** Rotate a surface 90 degree */
-struct transform_rot90
-{
- static inline int get_index(int width, int height, int x, int y) {
- return (x * height) + (height - y - 1);
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- return (height - y - 1);
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- return x;
- }
-
- static inline int get_width(int width, int height) { return height; }
- static inline int get_height(int width, int height) { return width; }
-};
-
-/** Rotate a surface 180 degree */
-struct transform_rot180
-{
- static inline int get_index(int width, int height, int x, int y) {
- return (width * height) - (y * width + x) - 1;
- }
-
- static inline int get_x(int width, int height, int x, int y) {
UNUSED_ARG(height); UNUSED_ARG(y);
- return width - x - 1;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
UNUSED_ARG(width); UNUSED_ARG(x);
- return height - y - 1;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(height);
return width; }
- static inline int get_height(int width, int height) { UNUSED_ARG(width);
return height; }
-};
-
-/** Rotate a surface 270 degree */
-struct transform_rot270
-{
- static inline int get_index(int width, int height, int x, int y) {
- return ((width - x - 1) * height) + y;
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(height); UNUSED_ARG(x);
- return y;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- UNUSED_ARG(height);
- UNUSED_ARG(y);
-
- return width - x - 1;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(width);
return height; }
- static inline int get_height(int width, int height) { UNUSED_ARG(height);
return width; }
-};
-
-/** flip a surface */
-struct transform_flip
-{
- static inline int get_index(int width, int height, int x, int y) {
- UNUSED_ARG(height);
- return (y * width) + (width - x - 1);
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- UNUSED_ARG(height); UNUSED_ARG(y);
- return width - x - 1;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(height); UNUSED_ARG(x);
- return y;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(height);
return width; }
- static inline int get_height(int width, int height) { UNUSED_ARG(width);
return height; }
-};
-
-/** Rotate a surface 90 degree and then flip it */
-struct transform_rot90_flip
-{
- static inline int get_index(int width, int height, int x, int y) {
- UNUSED_ARG(width);
- return (x * height) + y;
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(height); UNUSED_ARG(x);
- return y;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(height); UNUSED_ARG(y);
- return x;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(width);
return height; }
- static inline int get_height(int width, int height) { UNUSED_ARG(height);
return width; }
-};
-
-/** Rotate a surface 180 degree and then flip it */
-struct transform_rot180_flip
-{
- static inline int get_index(int width, int height, int x, int y) {
- return ((height - y - 1) * width) + x;
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(height); UNUSED_ARG(y);
- return x;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(x);
- return height - y - 1;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(height);
return width; }
- static inline int get_height(int width, int height) { UNUSED_ARG(width);
return height; }
-};
-
-/** Rotate a surface 270 degree and then flip it */
-struct transform_rot270_flip
-{
- static inline int get_index(int width, int height, int x, int y) {
- return ((width - x - 1) * height) + height - y - 1;
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(x);
- return height - y - 1;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- UNUSED_ARG(height); UNUSED_ARG(y);
- return width - x - 1;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(width);
return height; }
- static inline int get_height(int width, int height) { UNUSED_ARG(height);
return width; }
-};
-
-template<class TransF>
-inline
-PixelBuffer modify(PixelBuffer prov, const TransF&)
-{
- if (prov.get_format().get_type() == pixelformat_index)
- {
- CL_PixelFormat format(8, 0, 0, 0, 0,
- prov.get_format().has_colorkey(),
prov.get_format().get_colorkey(),
- pixelformat_index);
-
- PixelBuffer canvas(TransF::get_width (prov.get_width(),
prov.get_height()),
- TransF::get_height(prov.get_width(),
prov.get_height()),
- TransF::get_width (prov.get_width(),
prov.get_height()),
- format, prov.get_palette());
-
- prov.lock ();
- canvas.lock ();
-
- unsigned char* source_buf = static_cast<unsigned char*>(prov.get_data());
- unsigned char* target_buf = static_cast<unsigned
char*>(canvas.get_data());
-
- int pwidth = prov.get_width();
- int pheight = prov.get_height();
-
- for (int y = 0; y < pheight; ++y)
- for (int x = 0; x < pwidth; ++x)
- {
- target_buf[TransF::get_index(pwidth, pheight, x, y)] =
source_buf[y * pwidth + x];
- }
-
- canvas.unlock ();
- prov.unlock ();
-
- return canvas;
- }
- else
- {
- int pwidth = prov.get_width();
- int pheight = prov.get_height();
-
- PixelBuffer canvas(prov.get_height(), pwidth,
pheight*4, CL_PixelFormat::rgba8888);
-
- prov.lock();
- canvas.lock();
-
- for (int y = 0; y < pheight; ++y)
- for (int x = 0; x < pwidth; ++x)
- {
- Color color = prov.get_pixel(x, y);
- canvas.draw_pixel(TransF::get_x(pwidth, pheight, x, y),
- TransF::get_y(pwidth, pheight, x, y),
- color);
- }
-
- canvas.unlock ();
- prov.unlock ();
-
- return canvas;
- }
-}
-
-} // namespace BlitterImpl
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/blitter_test.cpp (from rev 2685,
branches/pingus_sdl/src/blitter_test.cxx)
Deleted: branches/pingus_sdl/src/blitter_test.cxx
===================================================================
--- branches/pingus_sdl/src/blitter_test.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/blitter_test.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,72 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <ClanLib/Core/System/system.h>
-#include <ClanLib/Display/surface.h>
-#include "resource.hxx"
-#include "timer.hxx"
-#include "blitter.hxx"
-#include "blitter_test.hxx"
-
-
-class BlitterTestImpl
-{
-public:
- BlitterTestImpl() {}
- void run()
- {
- //CL_Surface surf = Resource::load_surface("textures/stone", "textures");
- CL_Surface surf = Resource::load_surface("textures/greentex");
-
- PixelBuffer buf(256, 256, 256*4, CL_PixelFormat::rgba8888);
- PixelBuffer data = surf.get_pixeldata();
- Timer bench("Blit");
- Blitter::put_surface(buf, data, 0, 0);
- Blitter::fill_rect(buf, CL_Rect(-50, -50, 250, 250), Color(255, 150, 50,
128));
- Blitter::fill_rect(buf, CL_Rect(50, 50, 150, 150), Color(255, 150, 50,
155));
- bench.stop();
-
- CL_Surface surf2(buf);
-
- while(!CL_Keyboard::get_keycode(CL_KEY_ESCAPE))
- {
- CL_Display::clear(Color(155, 0, 0));
- surf.draw(0, 0);
- surf2.draw(400, 0);
-
- CL_Display::flip();
- CL_System::keep_alive();
- CL_System::sleep(100);
- }
- }
-};
-
-BlitterTest::BlitterTest()
-{
- impl = new BlitterTestImpl();
-}
-
-void
-BlitterTest::run()
-{
- impl->run();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/blitter_test.hpp (from rev 2685,
branches/pingus_sdl/src/blitter_test.hxx)
Deleted: branches/pingus_sdl/src/blitter_test.hxx
===================================================================
--- branches/pingus_sdl/src/blitter_test.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/blitter_test.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,39 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_BLITTER_TEST_HXX
-#define HEADER_BLITTER_TEST_HXX
-
-
-class BlitterTestImpl;
-
-/** */
-class BlitterTest
-{
-private:
- BlitterTestImpl* impl;
-public:
- BlitterTest();
- void run();
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/capture_rectangle.cpp (from rev 2685,
branches/pingus_sdl/src/capture_rectangle.cxx)
Deleted: branches/pingus_sdl/src/capture_rectangle.cxx
===================================================================
--- branches/pingus_sdl/src/capture_rectangle.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/capture_rectangle.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,109 +0,0 @@
-// $Id: capture_rectangle.cxx,v 1.17 2003/10/22 11:11:22 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "math/vector3f.hpp"
-#include "pingu.hxx"
-#include "resource.hxx"
-#include "capture_rectangle.hxx"
-#include "pingu_action.hxx"
-#include "components/button_panel.hxx"
-#include "globals.hxx"
-#include "display/scene_context.hxx"
-#include "fonts.hxx"
-
-CaptureRectangle::CaptureRectangle (ButtonPanel* arg_button_panel)
- : pingu(0),
- owner_id(0),
- good(Resource::load_sprite("game/cursors/capgood")),
- bad(Resource::load_sprite("game/cursors/capbad")),
- arrow_left(Resource::load_sprite("game/cursors/arrow_left")),
- arrow_right(Resource::load_sprite("game/cursors/arrow_right")),
- button_panel(arg_button_panel),
- font(Fonts::courier_small)
-{
-}
-
-CaptureRectangle::~CaptureRectangle ()
-{
-}
-
-void
-CaptureRectangle::draw(SceneContext& sc)
-{
- if (pingu && pingu->catchable())
- {
- // Draw the capture rectangle
- if (pingu->change_allowed(button_panel->get_action_name()))
- {
- sc.color().draw(good, pingu->get_center_pos() + Vector3f(0, 0,
1000));
- }
- else
- {
- sc.color().draw(bad, pingu->get_center_pos() + Vector3f(0, 0, 1000));
- }
-
- // Paint the direction arrow
- if (pingu->direction.is_left())
- {
- sc.color().draw(arrow_left, pingu->get_center_pos() + Vector3f(0, 0,
1000));
- }
- else
- {
- sc.color().draw(arrow_right, pingu->get_center_pos() + Vector3f(0,
0, 1000));
- }
-
- sc.color().print_center(font,
- pingu->get_center_pos().x,
- pingu->get_center_pos().y - 32,
- action_str,
- 1000);
- }
-}
-
-void
-CaptureRectangle::set_pingu (Pingu* p)
-{
- pingu = p;
-
- if (pingu)
- {
- action_str = pingu->get_name();
-
- if (pingu->get_wall_action() || pingu->get_fall_action())
- {
- action_str += "[";
-
- if (pingu->get_wall_action())
- action_str += pingu->get_wall_action()->get_persistent_char();
-
- if (pingu->get_fall_action())
- action_str += pingu->get_fall_action()->get_persistent_char();
-
- action_str += "]";
- }
-
- if (maintainer_mode)
- {
- action_str += " Id: ";
- ////action_str += CL_String::to(pingu->get_id());
- }
- }
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/capture_rectangle.hpp (from rev 2685,
branches/pingus_sdl/src/capture_rectangle.hxx)
Deleted: branches/pingus_sdl/src/capture_rectangle.hxx
===================================================================
--- branches/pingus_sdl/src/capture_rectangle.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/capture_rectangle.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,70 +0,0 @@
-// $Id: capture_rectangle.hxx,v 1.9 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_CAPTURE_RECTANGLE_HXX
-#define HEADER_PINGUS_CAPTURE_RECTANGLE_HXX
-
-class Font;
-class Pingu;
-class PinguAction;
-class Pingu;
-class ButtonPanel;
-class DrawingContext;
-
-#include "font.hpp"
-#include "sprite.hpp"
-
-/** The rectangle that is shown when the mouse cursor is above a
- pingu. The rectangle shows the current pingu direction along with
- the current active action.
- */
-class CaptureRectangle
-{
-private:
- Pingu* pingu;
- std::string action_str;
-
- /// The id of the owner of this capture rectangle
- int owner_id;
-
- Sprite good;
- Sprite bad;
- Sprite arrow_left;
- Sprite arrow_right;
-
- ButtonPanel* button_panel;
- Font font;
-
-public:
- CaptureRectangle(ButtonPanel*);
- ~CaptureRectangle();
-
- void set_pingu(Pingu* pingu);
-
- void draw(SceneContext& gc);
-
-private:
- CaptureRectangle (const CaptureRectangle&);
- CaptureRectangle& operator= (const CaptureRectangle&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/cheat.cpp (from rev 2685,
branches/pingus_sdl/src/cheat.cxx)
Deleted: branches/pingus_sdl/src/cheat.cxx
===================================================================
--- branches/pingus_sdl/src/cheat.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/cheat.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,68 +0,0 @@
-// $Id: cheat.cxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "pingus_error.hxx"
-#include "cheat.hxx"
-
-bool Cheat::unlimited_actions = false;
-bool Cheat::no_time_limit = false;
-bool Cheat::all_actions = false;
-
-void
-Cheat::activate(const std::string& cheat)
-{
- if (cheat == "unlimited-actions" || cheat == "ua")
- {
- unlimited_actions = true;
- }
- else if (cheat == "all-actions" || cheat == "aa")
- {
- all_actions = true;
- unlimited_actions = true;
- }
- else if (cheat == "no-time-limit" || cheat == "nt")
- {
- no_time_limit = true;
- }
- else if (cheat == "help")
- {
- print_help();
- }
- else
- {
- PingusError::raise("Cheat: Unknown cheat '" + cheat + "'");
- }
-}
-
-void
-Cheat::print_help()
-{
- std::cout
- << "Pingus Cheats\n"
- << "-------------\n"
- << " unlimited-actions(ua) - the number of available actions is not
limited\n"
- << " all-actions(aa) - all actions are available in all levels and
unlimited\n"
- << " no-time-limit(nt) - time limit is disabled everywhere\n"
- << std::endl;
-
- exit(EXIT_SUCCESS);
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/cheat.hpp (from rev 2685,
branches/pingus_sdl/src/cheat.hxx)
Deleted: branches/pingus_sdl/src/cheat.hxx
===================================================================
--- branches/pingus_sdl/src/cheat.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/cheat.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,46 +0,0 @@
-// $Id: cheat.hxx,v 1.3 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_CHEAT_HXX
-#define HEADER_PINGUS_CHEAT_HXX
-
-#include <string>
-
-/** */
-namespace Cheat
-{
-/** unlimited actions are available */
-extern bool unlimited_actions;
-
-/** no timelimit for all levels */
-extern bool no_time_limit;
-
-/** all actions are available in all levels */
-extern bool all_actions;
-
-/** Activate the given cheat */
-void activate(const std::string&);
-
-/** Print a list off possible cheats to stdout */
-void print_help();
-}
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/client.cpp (from rev 2685,
branches/pingus_sdl/src/client.cxx)
Deleted: branches/pingus_sdl/src/client.cxx
===================================================================
--- branches/pingus_sdl/src/client.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/client.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,246 +0,0 @@
-// $Id: client.cxx,v 1.50 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "globals.hxx"
-#include "components/playfield.hxx"
-#include "timer.hxx"
-#include "resource.hxx"
-#include "sound/sound.hxx"
-#include "components/time_display.hxx"
-#include "components/pingus_counter.hxx"
-#include "components/smallmap.hxx"
-#include "components/hurry_up.hxx"
-#include "path_manager.hxx"
-#include "gui/cursor.hxx"
-#include "true_server.hxx"
-#include "components/button_panel.hxx"
-#include "gui/gui_manager.hxx"
-
-
-Client::Client (TrueServer * s)
- : server (s),
- skip_frame (0),
- do_replay (false),
- is_finished (false),
- button_panel (0),
- pcounter (0),
- playfield (0),
- time_display (0),
- small_map (0),
- hurry_up (0)
-{
- Timer timer("Client UI generation");
-
- // These object will get deleted by the gui_manager
- button_panel = new ButtonPanel(this, 2, Display::get_height()/2);
- playfield = new Playfield(this, Rect(Vector2i(0, 0),
Size(Display::get_width(),
-
Display::get_height())));
- hurry_up = new HurryUp(this);
- pcounter = new PingusCounter(get_server());
- small_map = new SmallMap(this);
- time_display = new TimeDisplay(this);
-
- gui_manager->add(playfield, true);
- gui_manager->add(button_panel, true);
- gui_manager->add(hurry_up, true);
- gui_manager->add(pcounter, true);
- gui_manager->add(small_map, true);
- gui_manager->add(time_display, true);
-
- gui_manager->add(new ArmageddonButton(server, Display::get_width() - 40,
Display::get_height() - 62), true);
- gui_manager->add(new ForwardButton (server, Display::get_width() - 40 * 2,
Display::get_height() - 62), true);
- gui_manager->add(new PauseButton (server, Display::get_width() - 40 * 3,
Display::get_height() - 62), true);
- // Connect the button_panel with the playfield
- playfield->set_server(server);
-
- timer.stop();
-}
-
-Client::~Client()
-{
-}
-
-void
-Client::update (const GameDelta& delta)
-{
- GUIScreen::update (delta);
- process_events(delta);
-}
-
-void
-Client::process_events (const GameDelta& delta)
-{
- const Input::EventLst& events = delta.get_events ();
-
- for (Input::EventLst::const_iterator i = events.begin ();
- i != events.end ();
- ++i)
- {
- //std::cout << "Events: " << (*i)->get_type () << std::endl;
-
- switch (i->type)
- {
- case Input::ButtonEventType:
- {
- const Input::ButtonEvent& ev = i->button;
-
- if (ev.state == Input::pressed)
- {
- if (ev.name >= Input::action_1 && ev.name <= Input::action_10)
- {
- button_panel->set_button(ev.name - Input::action_1);
- }
- else if (ev.name == Input::action_down)
- {
- button_panel->next_action();
- }
- else if (ev.name == Input::action_up)
- {
- button_panel->previous_action();
- }
- }
- }
- break;
-
- case Input::PointerEventType:
- // Ignore, is handled in GUIScreen
- break;
-
- case Input::AxisEventType:
- // ???
- process_axis_event (i->axis);
- break;
-
- case Input::ScrollEventType:
- process_scroll_event(i->scroll);
- break;
-
- default:
- // unhandled event
- std::cout << "Client::process_events (): unhandled event: " <<
i->type << std::endl;
- break;
- }
- }
-}
-
-void
-Client::process_scroll_event (const Input::ScrollEvent& ev)
-{
- playfield->scroll(static_cast<int>(-ev.x_delta),
- static_cast<int>(-ev.y_delta));
-}
-
-void
-Client::process_axis_event (const Input::AxisEvent& event)
-{
- std::cout << "Client::process_axis_event ()" << std::endl;
- UNUSED_ARG(event);
-}
-
-bool
-Client::replay()
-{
- return do_replay;
-}
-
-void
-Client::do_restart()
-{
- do_replay = true;
- server->set_finished();
-}
-
-bool
-Client::finished()
-{
- return is_finished;
-}
-
-void
-Client::set_finished()
-{
- is_finished = true;
- server->set_finished();
-}
-
-void
-Client:: on_escape_press ()
-{
- server->set_finished();
-}
-
-void
-Client:: on_pause_press ()
-{
- server->set_pause (!server->get_pause ());
-}
-
-void
-Client::on_fast_forward_press ()
-{
- server->set_fast_forward(!server->get_fast_forward());
-}
-
-void
-Client::on_armageddon_press ()
-{
- server->send_armageddon_event();
-}
-
-void
-Client::on_action_axis_move (float move)
-{
- if (move > 0)
- button_panel->next_action ();
- else if (move < 0)
- button_panel->previous_action ();
-}
-
-void
-Client::on_startup ()
-{
- do_replay = false;
- is_finished = false;
- skip_frame = 0;
-
- if (maintainer_mode)
- std::cout << "Starting Music: " << server->get_plf().get_music() <<
std::endl;
-
- if (server->get_plf().get_music() == "none")
- {
- Sound::PingusSound::stop_music();
- }
- else
- {
- Sound::PingusSound::play_music(server->get_plf().get_music());
- }
-
- if (verbose)
- std::cout << "Client: Entering main_loop. Startup time: "
- << SDL_GetTicks() << " msec." << std::endl;
-}
-
-void
-Client::on_shutdown ()
-{
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/client.hpp (from rev 2685,
branches/pingus_sdl/src/client.hxx)
Deleted: branches/pingus_sdl/src/client.hxx
===================================================================
--- branches/pingus_sdl/src/client.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/client.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,112 +0,0 @@
-// $Id: client.hxx,v 1.30 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_CLIENT_HXX
-#define HEADER_PINGUS_CLIENT_HXX
-
-#include "gui/gui_screen.hxx"
-
-namespace Input {
-class Controller;
-struct ButtonEvent;
-struct PointerEvent;
-struct ScrollEvent;
-struct AxisEvent;
-struct KeyboardEvent;
-} // namespace Input
-
-namespace GUI {
-class RootGUIManager;
-} // namespace GUI
-
-class Vector;
-class ButtonPanel;
-class Controller;
-class Cursor;
-class HurryUp;
-class PingusCounter;
-class Playfield;
-class TrueServer;
-class SmallMap;
-class TimeDisplay;
-
-/** FIXME: This whole Server/Client concept is a bit screwed */
-class Client : public GUIScreen
-{
-private:
- TrueServer* server;
-
- int skip_frame;
- bool do_replay;
- bool is_finished;
-
- ButtonPanel* button_panel;
- PingusCounter* pcounter;
- Playfield* playfield;
- TimeDisplay* time_display;
- SmallMap* small_map;
- HurryUp* hurry_up;
-
- bool enabled;
-
-public:
- Client(TrueServer* s);
- virtual ~Client();
-
- TrueServer* get_server() { return server; }
- Playfield* get_playfield() { return playfield; }
-
- bool replay();
- void do_restart();
- bool finished();
- void set_finished();
-
- /** Update all parts of the world */
- void update (const GameDelta&);
-
- //void process_events ();
-
- ButtonPanel* get_button_panel () { return button_panel; }
-
- void on_primary_button_press(int x, int y);
- void on_primary_button_release(int x, int y);
-
- // Overloaded GUIScreen stuff
- void on_startup ();
- void on_shutdown ();
-
- void on_pause_press ();
- void on_fast_forward_press ();
- void on_armageddon_press ();
- void on_escape_press ();
- void on_action_axis_move (float);
-
-private:
- void process_events (const GameDelta& events);
- void process_scroll_event (const Input::ScrollEvent&);
- void process_axis_event (const Input::AxisEvent&);
-
- Client (const Client&);
- Client& operator= (const Client&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/col_map.cpp (from rev 2685,
branches/pingus_sdl/src/col_map.cxx)
Deleted: branches/pingus_sdl/src/col_map.cxx
===================================================================
--- branches/pingus_sdl/src/col_map.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/col_map.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,304 +0,0 @@
-// $Id: col_map.cxx,v 1.23 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "SDL.h"
-#include "display/drawing_context.hxx"
-#include "globals.hxx"
-#include "col_map.hxx"
-#include "pixel_buffer.hpp"
-#include "pingus_error.hxx"
-#include "gettext.h"
-
-#define COLMAP_WITH_MEMORY_HOLE 1
-
-
-// Obtain the colmap from a memory area
-ColMap::ColMap(int w, int h)
- : serial(0),
- width(w),
- height(h),
- colmap(new unsigned char[width * height])
-{
- // Clear the colmap
- memset(colmap, Groundtype::GP_NOTHING, sizeof(unsigned char) * width *
height);
-}
-
-ColMap::~ColMap()
-{
- //std::cout << "ColMap:~ColMap" << std::endl;
- delete[] colmap;
-}
-
-int
-ColMap::getpixel(int x, int y)
-{
- if (x >= 0 && x < width && y >= 0 && y < height) {
- return colmap[x+y*width];
- } else {
- return Groundtype::GP_OUTOFSCREEN;
- }
-}
-
-unsigned char*
-ColMap::get_data()
-{
- return colmap;
-}
-
-int
-ColMap::get_height()
-{
- return height;
-}
-
-int
-ColMap::get_width()
-{
- return width;
-}
-
-void
-ColMap::remove(PixelBuffer provider, int x, int y)
-{
-#if 0
- ++serial;
-
- int swidth = provider.get_width();
- int sheight = provider.get_height();
- int y_offset = -y;
- int x_offset = -x;
- if (y_offset < 0) y_offset = 0;
- if (x_offset < 0) x_offset = 0;
-
- provider.lock();
-
- if (provider.get_format().get_depth() == 32)
- {
- for(int line = y_offset; line < sheight && (line + y) < height;
++line)
- {
- for (int i = x_offset; i < swidth && (i+x) < width; ++i)
- {
- if (provider.get_pixel(i, line).get_alpha() !=
0)
- {
- if (colmap[i + (width*(line+y) + x)] !=
Groundtype::GP_SOLID)
- colmap[i + (width*(line+y) +
x)] = Groundtype::GP_NOTHING;
- }
- }
- }
- }
- else if (provider.get_format().get_depth() == 8)
- {
- unsigned char* buffer;
- buffer = static_cast<unsigned char*>(provider.get_data());
-
- for(int line = y_offset; line < sheight && (line + y) < height;
++line)
- {
- for (int i = x_offset; i < swidth && (i+x) < width; ++i)
- {
- if (buffer[i + (swidth*line)])
- {
- if (colmap[i + (width*(line+y) + x)] !=
Groundtype::GP_SOLID)
- colmap[i + (width*(line+y) +
x)] = Groundtype::GP_NOTHING;
- }
- }
- }
- }
- else
- {
- PingusError::raise("ColMap::remove() - image format not
supported");
- }
-
- provider.unlock();
-#endif
-}
-
-void
-ColMap::put(int x, int y, Groundtype::GPType p)
-{
- ++serial;
-
- if (x > 0 && x < width
- && y > 0 && y < height)
- {
- colmap[x+y*width] = p;
- }
- else
- {
- if (verbose > 2)
- std::cout << "ColMap: remove: Out of map" << std::endl;
- }
-}
-
-bool
-ColMap::blit_allowed (int x, int y, Groundtype::GPType gtype)
-{
- // FIXME: Inline me
- if (gtype == Groundtype::GP_BRIDGE)
- {
- int pixel = getpixel (x, y);
- return pixel == Groundtype::GP_NOTHING;
- }
- else
- {
- return true;
- }
-}
-
-// Puts a surface on the colmap
-void
-ColMap::put(PixelBuffer provider, int sur_x, int sur_y, Groundtype::GPType
pixel)
-{
- // transparent groundpieces are only drawn on the gfx map, not on the colmap
- if (pixel == Groundtype::GP_TRANSPARENT)
- return;
-
- if ((sur_x > width) || (sur_y > height))
- {
- if (verbose > 3)
- {
- std::cout << "Warning: ColMap: Spot out of screen" << std::endl;
- std::cout << "sur_x: " << sur_x << " sur_y: " << sur_y << std::endl;
- }
- return;
- }
-
- // FIXME: Little slow
- provider.lock();
- // Rewritting blitter for 32bit depth (using get_pixel())
- for (int y=0; y < provider.get_height(); ++y)
- for (int x=0; x < provider.get_width(); ++x)
- {
- Color color = provider.get_pixel(x, y);
- if (color.a > 32) // Alpha threshold
- {
- if (blit_allowed (x + sur_x, y + sur_y, pixel))
- put(x + sur_x, y + sur_y, pixel);
- }
- }
- provider.unlock();
-
-#if 0
- else if (provider.get_format().get_depth() == 8)
- {
- unsigned char* buffer;
- int swidth = provider.get_width();
- int sheight = provider.get_height();
- int y_offset = -sur_y;
- int x_offset = -sur_x;
- if (y_offset < 0) y_offset = 0;
- if (x_offset < 0) x_offset = 0;
-
- //provider.lock();
- buffer = static_cast<unsigned char*>(provider.get_data());
-
- if (provider.get_format().has_colorkey())
- {
- unsigned int colorkey = provider.get_format().get_colorkey();
- for(int line = y_offset; line < sheight && (line + sur_y) < height;
++line)
- for (int i = x_offset; i < swidth && (i+sur_x) < width; ++i)
- {
- if (buffer[i + (swidth*line)] != colorkey)
- {
- if (blit_allowed (i + sur_x, line + sur_y, pixel))
- colmap[i + (width*(line+sur_y) + sur_x)] = pixel;
- }
- }
- }
- else
- {
- for(int line = y_offset; line < sheight && (line + sur_y) < height;
++line)
- for (int i = x_offset; i < swidth && (i+sur_x) < width; ++i)
- {
- if (blit_allowed (i + sur_x, line + sur_y, pixel))
- colmap[i + (width*(line+sur_y) + sur_x)] = pixel;
- }
- }
- }
- else
- {
- std::cout << "ColMap: Unsupported color depth, ignoring" << std::endl;
- }
-
- // FIXME: Memory hole
- // provider.unlock();
-#endif
-}
-
-void
-ColMap::draw(DrawingContext& gc)
-{
-#if 0
- PixelBuffer canvas(width, height, width*4, CL_PixelFormat::rgba8888);
- CL_Surface sur;
- unsigned char* buffer;
-
- canvas.lock();
- buffer = static_cast<unsigned char*>(canvas.get_data());
-
- for(int i = 0; i < (width * height); ++i)
- {
- switch(colmap[i])
- {
- case Groundtype::GP_NOTHING:
- buffer[i * 4 + 0] = 0;
- buffer[i * 4 + 1] = 0;
- buffer[i * 4 + 2] = 0;
- buffer[i * 4 + 3] = 0;
- break;
-
- case Groundtype::GP_SOLID:
- buffer[i * 4 + 0] = 255;
- buffer[i * 4 + 1] = 100;
- buffer[i * 4 + 2] = 100;
- buffer[i * 4 + 3] = 100;
- break;
-
- case Groundtype::GP_BRIDGE:
- buffer[i * 4 + 0] = 255;
- buffer[i * 4 + 1] = 0;
- buffer[i * 4 + 2] = 0;
- buffer[i * 4 + 3] = 200;
- break;
-
- default:
- buffer[i * 4 + 0] = 255;
- buffer[i * 4 + 1] = 200;
- buffer[i * 4 + 2] = 200;
- buffer[i * 4 + 3] = 200;
- break;
- }
- }
-
- canvas.unlock();
-
- sur = CL_Surface(canvas);
-
- //FIXME:gc.draw(sur, 0, 0);
-#endif
-}
-
-unsigned
-ColMap::get_serial()
-{
- return serial;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/col_map.hpp (from rev 2685,
branches/pingus_sdl/src/col_map.hxx)
Deleted: branches/pingus_sdl/src/col_map.hxx
===================================================================
--- branches/pingus_sdl/src/col_map.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/col_map.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,95 +0,0 @@
-// $Id: col_map.hxx,v 1.15 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_COL_MAP_HXX
-#define HEADER_PINGUS_COL_MAP_HXX
-
-#include "groundtype.hxx"
-
-class CL_Surface;
-class PixelBuffer;
-
-class DrawingContext;
-class ResDescriptor;
-class PixelStatus;
-
-// Collsion Map
-/** The collision map is used to represent the enviroment where the
- Pingus walk around. The ground can have different properties, it
- can contain lava or water, it can be solid and many more. */
-class ColMap
-{
-private:
- /** The serial number indicates the state of the colmap, on every
- change of the colmap it will get increased. */
- unsigned int serial;
-
- /** The width of the collision map. */
- int width;
-
- /** The height of the collision map. */
- int height;
-
- /** A array of uchar, each uchar represents a pixel on the map. */
- unsigned char* colmap;
-
-public:
- /** Init the colmap from a given area of memory.
- The memory will be deleted in the destructor. */
- ColMap(int w, int h);
-
- /** delete[] the uchar array used for the colmap */
- ~ColMap();
-
- /** Returns the raw uchar array used for the inner representation of
- the colmap. This is used by the smallmap to create the radar */
- unsigned char* get_data();
-
- /** Returns the height of the collision map. */
- int get_height();
-
- /** Returns the height of the collision map. */
- int get_width();
-
- int getpixel(int x, int y);
-
- /** @return a number which represents the state of the collision
- map, once it changes the serial changes also */
- unsigned get_serial();
-
- /** Return true if the given GroundType i*/
- bool blit_allowed (int x, int y, Groundtype::GPType);
-
- void put(int x, int y, Groundtype::GPType p = Groundtype::GP_GROUND);
- void put(PixelBuffer, int x, int y, Groundtype::GPType);
-
- void remove(int x, int y);
- void remove(PixelBuffer, int x, int y);
-
- void draw(DrawingContext& gc);
-
-private:
- ColMap (const ColMap&);
- ColMap& operator= (const ColMap&);
-};
-
-
-#endif /* COLMAP_HH */
-
-/* EOF */
Copied: branches/pingus_sdl/src/collider.cpp (from rev 2685,
branches/pingus_sdl/src/collider.cxx)
Deleted: branches/pingus_sdl/src/collider.cxx
===================================================================
--- branches/pingus_sdl/src/collider.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/collider.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,49 +0,0 @@
-// $Id: collider.cxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "collider.hxx"
-#include "col_map.hxx"
-#include "math/vector3f.hpp"
-#include "world.hxx"
-
-Collider::Collider()
-{
-}
-
-Collider::~Collider()
-{
-}
-
-bool Collider::operator() (World* const world, Vector3f current_pos,
- const Vector3f& step_vector) const
-{
- UNUSED_ARG(world);
- UNUSED_ARG(current_pos);
- UNUSED_ARG(step_vector);
-
- return false;
-}
-
-int Collider::getpixel(World* const world, const Vector3f& pos) const
-{
- return world->get_colmap()->getpixel(static_cast<int>(pos.x),
- static_cast<int>(pos.y));
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/collider.hpp (from rev 2685,
branches/pingus_sdl/src/collider.hxx)
Deleted: branches/pingus_sdl/src/collider.hxx
===================================================================
--- branches/pingus_sdl/src/collider.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/collider.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,49 +0,0 @@
-// $Id: collider.hxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_COLLIDER_HXX
-#define HEADER_PINGUS_COLLIDER_HXX
-
-
-class Vector3f;
-class World;
-
-class Collider
-{
- public:
- /** Constructor for abstract class */
- Collider();
-
- /** Destructor for abstract class */
- virtual ~Collider() = 0;
-
- /** Find out if object will collide with something */
- virtual bool operator() (World* const world, Vector3f current_pos,
- const Vector3f& step_vector) const = 0;
-
- protected:
- /** Get the Collision Map pixel at the specified position in the specified
- world */
- int getpixel(World* const world, const Vector3f& pos) const;
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/colliders/pingu_collider.cpp (from rev 2685,
branches/pingus_sdl/src/colliders/pingu_collider.cxx)
Deleted: branches/pingus_sdl/src/colliders/pingu_collider.cxx
===================================================================
--- branches/pingus_sdl/src/colliders/pingu_collider.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/colliders/pingu_collider.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,88 +0,0 @@
-// $Id: pingu_collider.cxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../pingu_action.hxx"
-#include "../groundtype.hxx"
-#include "../math/vector3f.hpp"
-#include "pingu_collider.hxx"
-
-namespace Colliders {
-
-PinguCollider::PinguCollider(const int height_arg) : height(height_arg)
-{
-}
-
-PinguCollider::~PinguCollider()
-{
-}
-
-bool PinguCollider::operator() (World* const world, Vector3f current_pos,
- const Vector3f& step_vector) const
-{
- Vector3f new_pos = current_pos + step_vector;
- int pixel;
- bool falling = false;
- bool collided = false;
-
- if (step_vector.y > 0.0f)
- falling = true;
-
- // If the Pingu is going to move sideways to the next pixel...
- if (static_cast<int>(new_pos.x) != static_cast<int>(current_pos.x))
- {
- float top_of_pingu = new_pos.y - height;
-
- for (; new_pos.y >= top_of_pingu; --new_pos.y)
- {
- pixel = getpixel(world, new_pos);
-
- // If there is something in the way, then Pingu has collided with
- // something. However, if not falling and colliding with a
- // Bridge, allow Pingu to go through it.
- if ((!falling || pixel != Groundtype::GP_BRIDGE)
- && pixel != Groundtype::GP_NOTHING)
- {
- collided = true;
- break;
- }
- }
- }
- // If the Pingu is not falling...
- else if (!falling)
- {
- pixel = getpixel(world, Vector3f(new_pos.x, new_pos.y - height));
-
- // If the top of the Pingu has hit something except a bridge...
- if (pixel != Groundtype::GP_NOTHING && pixel != Groundtype::GP_BRIDGE)
- {
- collided = true;
- }
- }
- // If the Pingu's "feet" has hit something...
- else if (getpixel(world, new_pos) != Groundtype::GP_NOTHING)
- {
- collided = true;
- }
-
- return collided;
-}
-
-} // namespace Colliders
-
-/* EOF */
Copied: branches/pingus_sdl/src/colliders/pingu_collider.hpp (from rev 2685,
branches/pingus_sdl/src/colliders/pingu_collider.hxx)
Deleted: branches/pingus_sdl/src/colliders/pingu_collider.hxx
===================================================================
--- branches/pingus_sdl/src/colliders/pingu_collider.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/colliders/pingu_collider.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,51 +0,0 @@
-// $Id: pingu_collider.hxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_UPRIGHT_PINGU_COLLIDER_HXX
-#define HEADER_PINGUS_UPRIGHT_PINGU_COLLIDER_HXX
-
-#include "../collider.hxx"
-
-namespace Colliders {
-
-class PinguCollider : public Collider
-{
- public:
- /** Constructor */
- PinguCollider(const int height_arg);
-
- /** Destructor */
- ~PinguCollider();
-
- /** Find out if a Pingu at the specified position is colliding with
- something */
- bool operator() (World* const world, Vector3f current_pos,
- const Vector3f& step_vector) const;
-
- private:
- /** Pingu could be on its belly. Therefore, this is the current height of
- the Pingu. */
- int height;
-};
-
-} // namespace Colliders
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/action_button.cpp (from rev 2685,
branches/pingus_sdl/src/components/action_button.cxx)
Deleted: branches/pingus_sdl/src/components/action_button.cxx
===================================================================
--- branches/pingus_sdl/src/components/action_button.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/components/action_button.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,332 +0,0 @@
-// $Id: action_button.cxx,v 1.35 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../globals.hxx"
-#include "../cheat.hxx"
-#include "../resource.hxx"
-#include "action_button.hxx"
-#include "../true_server.hxx"
-#include "../world.hxx"
-#include "../display/drawing_context.hxx"
-#include "../gui/display.hxx"
-#include "../fonts.hxx"
-#include "../math/vector3f.hpp"
-
-
-using namespace Actions;
-
-ActionButton::ActionButton(ActionHolder* h)
-: action_holder(h){}
-
-ActionButton::~ActionButton() {}
-
-void
-ActionButton::init(int x, int y, ActionName name_, int owner_id)
-{
- // make_action = func;
- x_pos = x;
- y_pos = y;
- name = name_;
-
- font = Fonts::pingus_small;
- font_b = Fonts::pingus_large;
-
- sprite = Resource::load_sprite("pingus/player0/" + action_to_string(name) +
"/right");
-}
-
-bool
-ActionButton::is_pressed()
-{
- return false;
-}
-
-void
-ActionButton::update(float delta)
-{
- sprite.update(delta);
-}
-
-ActionName
-ActionButton::get_action_name()
-{
- return name;
-}
-
-VerticalActionButton::VerticalActionButton(ActionHolder* h,
- int x, int y, ActionName name_, int
owner_id)
- : ActionButton(h),
- background (Resource::load_sprite("core/buttons/buttonbackground")),
- backgroundhl (Resource::load_sprite("core/buttons/buttonbackgroundhl"))
-{
- init(x, y, name_, owner_id);
-}
-
-VerticalActionButton::~VerticalActionButton () {}
-
-bool
-VerticalActionButton::is_at (int x, int y)
-{
- if (x > x_pos && x < x_pos + 60
- && y > y_pos && y <= y_pos + 35)
- {
- return true;
- }
- else
- {
- return false;
- }
-}
-
-void
-VerticalActionButton::draw (DrawingContext& gc)
-{
- if (pressed)
- {
- if (fast_mode)
- {
- gc.draw_fillrect((float)x_pos, (float)y_pos, (float)x_pos + 60,
(float)y_pos + 35,
- Color(255, 255, 255));
- }
- else
- {
- //CL_Display::fill_rect(x_pos, y_pos, x_pos + 60, y_pos + 35 ,
- //1.0, 1.0, 1.0, 0.5);
- gc.draw(backgroundhl, (float)x_pos, (float)y_pos);
- }
- }
- else
- {
- sprite.set_frame(0);
-
- if (fast_mode) {
- // do nothing
- } else {
- gc.draw(background, (float)x_pos, (float)y_pos);
- }
- }
-
- gc.draw(sprite, Vector3f((float)x_pos + 20, (float)y_pos + 32));
-
- Font myfont = font;
- Font myfontb = font_b;
-
- // print the action name next to the button, when mouse pointer is on
- // the button.
- // FIXME: this should use the GUI events, not CL_Mouse
-#if 0
- if (action_help
- && CL_Mouse::get_x() > x_pos && CL_Mouse::get_x() < x_pos + 60
- && CL_Mouse::get_y() < y_pos + 35 && CL_Mouse::get_y() > y_pos)
- {
- gc.print_left(myfontb, (float)x_pos + 65, (float)y_pos,
action_to_screenname(name));
- }
-#endif
-
- if (Cheat::unlimited_actions)
- {
- // FIXME: insert unlimited surface here
- gc.print_center(myfont, (float)x_pos + 46, (float)y_pos + 5, "oo");
- }
- else
- {
-#if 0
- std::string str = CL_String::to(action_holder->get_available(name));
- gc.print_center(myfont, (float)x_pos + 46, (float)y_pos + 5, str);
-#endif
- }
-}
-
-ArmageddonButton::ArmageddonButton (TrueServer* s, int x, int y)
- : server (s),
- x_pos (x),
- y_pos (y),
- background (Resource::load_sprite("core/buttons/hbuttonbgb")),
- backgroundhl(Resource::load_sprite("core/buttons/hbuttonbg"))
-{
- pressed = false;
- sprite = Resource::load_sprite("core/buttons/armageddon_anim");
-}
-
-ArmageddonButton::~ArmageddonButton () { }
-
-void
-ArmageddonButton::draw (DrawingContext& gc)
-{
- if (server->get_world()->check_armageddon ())
- {
- gc.draw(backgroundhl, Vector3f((float)x_pos, (float)y_pos));
- gc.draw(sprite, Vector3f((float)x_pos, (float)y_pos));
- }
- else
- {
- if (!fast_mode)
- gc.draw(background, Vector3f((float)x_pos, (float)y_pos));
-
- sprite.set_frame(7);
- gc.draw(sprite, Vector3f((float)x_pos, (float)y_pos));
- }
-}
-
-void
-ArmageddonButton::update (float delta)
-{
- sprite.update(delta);
-
- if (pressed)
- {
- press_time += delta;
- if (press_time > 1.0f)
- {
- press_time = 0;
- pressed = false;
- }
- }
- else
- {
- pressed = false;
- press_time = 0;
- }
-}
-
-bool
-ArmageddonButton::is_at(int x, int y)
-{
- if (x > x_pos && x < x_pos + sprite.get_width()
- && y > y_pos && y < y_pos + sprite.get_height())
- {
- return true;
- } else {
- return false;
- }
-}
-
-void
-ArmageddonButton::on_primary_button_click (int x, int y)
-{
- if (pressed)
- {
- server->send_armageddon_event();
- }
- else
- {
- pressed = true;
- }
-
- UNUSED_ARG(x);
- UNUSED_ARG(y);
-}
-
-ForwardButton::ForwardButton (TrueServer* s, int x, int y)
- : server (s),
- x_pos (x), y_pos (y),
- background (Resource::load_sprite("core/buttons/hbuttonbgb")),
- backgroundhl(Resource::load_sprite("core/buttons/hbuttonbg"))
-{
- surface = Resource::load_sprite("core/buttons/fast_forward");
-}
-
-ForwardButton::~ForwardButton () {}
-
-void
-ForwardButton::draw (DrawingContext& gc)
-{
- if (server->get_fast_forward())
- {
- gc.draw(backgroundhl, Vector3f((float)x_pos, (float)y_pos));
- }
- else
- {
- if (!fast_mode)
- gc.draw(background, Vector3f((float)x_pos, (float)y_pos));
- }
-
- gc.draw(surface, Vector3f((float)x_pos, (float)y_pos));
-}
-
-bool
-ForwardButton::is_at (int x, int y)
-{
- if ( x > x_pos && x < x_pos + int(surface.get_width())
- && y > y_pos && y < y_pos + int(surface.get_height()))
- {
- return true;
- } else {
- return false;
- }
-}
-
-void
-ForwardButton::on_primary_button_click (int x, int y)
-{
- server->set_fast_forward(!server->get_fast_forward());
-
- UNUSED_ARG(x);
- UNUSED_ARG(y);
-}
-
-PauseButton::PauseButton (TrueServer* s, int x, int y)
- : server (s),
- x_pos(x), y_pos(y),
- background (Resource::load_sprite("core/buttons/hbuttonbgb")),
- backgroundhl(Resource::load_sprite("core/buttons/hbuttonbg"))
-{
- surface = Resource::load_sprite("core/buttons/pause");
-}
-
-PauseButton::~PauseButton () {}
-
-void
-PauseButton::draw (DrawingContext& gc)
-{
- if (server->get_pause())
- {
- gc.draw(backgroundhl, Vector3f((float)x_pos, (float)y_pos));
- }
- else
- {
- if (!fast_mode)
- gc.draw(background, Vector3f((float)x_pos, (float)y_pos));
- }
-
- gc.draw(surface, Vector3f((float)x_pos, (float)y_pos));
-}
-
-bool
-PauseButton::is_at (int x, int y)
-{
- if (x > x_pos && x < x_pos + int(surface.get_width())
- && y > y_pos && y < y_pos + int(surface.get_height()))
- {
- return true;
- } else {
- return false;
- }
-}
-
-void
-PauseButton::on_primary_button_click (int x, int y)
-{
- server->set_pause(!server->get_pause());
-
- UNUSED_ARG(x);
- UNUSED_ARG(y);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/action_button.hpp (from rev 2685,
branches/pingus_sdl/src/components/action_button.hxx)
Deleted: branches/pingus_sdl/src/components/action_button.hxx
===================================================================
--- branches/pingus_sdl/src/components/action_button.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/components/action_button.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,195 +0,0 @@
-// $Id: action_button.hxx,v 1.20 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ACTION_BUTTON_HXX
-#define HEADER_PINGUS_ACTION_BUTTON_HXX
-
-#include <string>
-#include "../font.hpp"
-#include "../pingu_enums.hxx"
-#include "../state_sprite.hxx"
-#include "../gui/component.hxx"
-
-class CL_Font;
-
-
-class TrueServer;
-class ActionHolder;
-class Vector;
-
-/** ArmageddonButton, press it to start the armageddon and to turn all
- pingus into bomber
-
- \sa Client */
-class ArmageddonButton : public GUI::Component
-{
-private:
- TrueServer* server;
- int x_pos;
- int y_pos;
- bool pressed;
- float press_time;
- Sprite sprite;
- Sprite background;
- Sprite backgroundhl;
-
- friend class ButtonPanel;
-public:
- ArmageddonButton(TrueServer*, int x, int y);
- virtual ~ArmageddonButton();
-
- void draw(DrawingContext& gc);
- void update(float);
- bool is_at(int x, int y);
- void on_primary_button_click (int x, int y);
-
-private:
- ArmageddonButton (const ArmageddonButton&);
- ArmageddonButton& operator= (const ArmageddonButton&);
-};
-
-// ----------------- snip --------------------
-
-/** Fast Forward button, press it to let the game run faster, press it
- again to return to normal speed
-
- \sa Client */
-class ForwardButton : public GUI::Component
-{
-private:
- TrueServer* server;
- int x_pos;
- int y_pos;
- Sprite surface;
- Sprite background;
- Sprite backgroundhl;
- friend class ButtonPanel;
-public:
- ForwardButton(TrueServer*, int x, int y);
- virtual ~ForwardButton();
-
- void draw(DrawingContext& gc);
- bool is_at (int x, int y);
- void on_primary_button_click (int x, int y);
-
-private:
- ForwardButton (const ForwardButton&);
- ForwardButton& operator= (const ForwardButton&);
-};
-
-// ----------------- snip --------------------
-
-/** Pause button, press it to pause the game, press it again to
- continue
-
- \sa Client */
-class PauseButton : public GUI::Component
-{
-private:
- TrueServer* server;
- int x_pos;
- int y_pos;
- Sprite surface;
- Sprite background;
- Sprite backgroundhl;
- friend class ButtonPanel;
-public:
- PauseButton(TrueServer*, int x, int y);
- virtual ~PauseButton();
-
- void draw(DrawingContext& gc);
- bool is_at (int x, int y);
- void on_primary_button_click (int x, int y);
-
-private:
- PauseButton (const PauseButton&);
- PauseButton& operator= (const PauseButton&);
-};
-
-// ----------------- snip --------------------
-
-/** The button class manage a simple button for the button_panel. It
- keeps his position, his surfaces and his font. */
-class ActionButton : public GUI::Component
-{
-protected:
- Sprite sprite;
- int x_pos;
- int y_pos;
- Font font;
- // Added for printing action names next to the button.
- Font font_b;
-
- Actions::ActionName name;
- bool is_multi_direct;
-
- ActionHolder* action_holder;
-
-public:
- bool pressed;
-
- ActionButton(ActionHolder*);
- virtual ~ActionButton();
-
- void init(int x, int y, Actions::ActionName name_, int owner_id);
-
- /// Not used.
- void update(float delta);
-
- /// Returns the name of the action the button represents.
- Actions::ActionName get_action_name();
-
- /// Returns true if the button is pressed.
- bool is_pressed();
-
- virtual bool is_at(int x, int y) = 0;
-
-private:
- ActionButton (const ActionButton&);
- ActionButton& operator= (const ActionButton&);
-};
-
-// ----------------- snip --------------------
-
-/** Button which represents an action, one you click it the current
- action will be set to the action represented by the button.
-
- \sa Client */
-class VerticalActionButton : public ActionButton
-{
-private:
- Sprite background;
- Sprite backgroundhl;
-
-public:
- VerticalActionButton(ActionHolder* h, int x, int y, Actions::ActionName
name, int owner_id);
- virtual ~VerticalActionButton();
-
- void draw(DrawingContext& gc);
- bool is_at (int x, int y);
-
-private:
- VerticalActionButton (const VerticalActionButton&);
- VerticalActionButton& operator= (const VerticalActionButton&);
-};
-
-
-#endif /* ACTIONBUTTON */
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/button_panel.cpp (from rev 2685,
branches/pingus_sdl/src/components/button_panel.cxx)
Deleted: branches/pingus_sdl/src/components/button_panel.cxx
===================================================================
--- branches/pingus_sdl/src/components/button_panel.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/button_panel.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,190 +0,0 @@
-// $Id: button_panel.cxx,v 1.28 2003/10/21 21:37:05 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <algorithm>
-#include "../globals.hxx"
-#include "../true_server.hxx"
-#include "../client.hxx"
-#include "button_panel.hxx"
-
-
-using namespace Actions;
-
-struct action_sorter {
- bool operator() (const ActionName& a, const ActionName& b) {
- return a < b;
- }
-};
-
-ButtonPanel::ButtonPanel(Client* c, int arg_x_pos, int arg_y_pos)
- : client(c),
- server(client->get_server()),
- armageddon_pressed(false),
- left_pressed(0),
- last_press(0),
- x_pos (arg_x_pos),
- y_pos (arg_y_pos)
-{
- ActionHolder* aholder = server->get_action_holder();
-
- std::vector<ActionName> actions = aholder->get_available_actions();
-
- // Sort the action so that they always have the same order in the
- // panel
- std::sort(actions.begin(), actions.end(), action_sorter());
-
- y_pos -= ((int)actions.size() * 38)/2 + 70;
-
- for(std::vector<ActionName>::iterator i = actions.begin();
- i != actions.end(); ++i)
- {
- a_buttons.push_back(new VerticalActionButton (aholder,
- x_pos, int(i -
actions.begin()) * 38 + y_pos,
- *i,
- 0));
//FIXMEcontroller->get_owner ()));
- }
-
- if (a_buttons.empty())
- {
- std::cout << "Error: ButtonPanel: No a_buttons! " << std::endl;
- }
-
- pressed_button = 0;
- ////wheel_slot = CL_Mouse::sig_key_down().connect(this,
&ButtonPanel::on_wheel_move);
-}
-
-#if 0
-void
-ButtonPanel::on_wheel_move(const CL_InputEvent& key)
-{
- if (key.id == CL_MOUSE_WHEEL_DOWN)
- {
- next_action();
- }
- else if (key.id == CL_MOUSE_WHEEL_UP)
- {
- previous_action();
- }
-}
-#endif
-
-ButtonPanel::~ButtonPanel()
-{
- for (AButtonIter it = a_buttons.begin(); it != a_buttons.end(); ++it)
- {
- delete *it;
- }
-}
-
-void
-ButtonPanel::update(float delta)
-{
- a_buttons[pressed_button]->update(delta);
-
- if (last_press + 350 < SDL_GetTicks())
- {
- armageddon_pressed = 0;
- }
-}
-
-ActionName
-ButtonPanel::get_action_name()
-{
- return a_buttons[pressed_button]->get_action_name();
-}
-
-void
-ButtonPanel::draw(DrawingContext& gc)
-{
- float alpha;
-
- if (fast_mode)
- alpha = 1.0;
- else
- alpha = 0.5;
-
- for(int i = 0; i < static_cast<int>(a_buttons.size()); ++i)
- {
- if (i == pressed_button)
- a_buttons[i]->pressed = true;
- else
- a_buttons[i]->pressed = false;
-
- a_buttons[i]->draw(gc);
- }
-}
-
-void
-ButtonPanel::set_button(int n)
-{
- if (n < 0 || n >= static_cast<int>(a_buttons.size()))
- {
- // FIXME: Play 'boing' sound here
- }
- else
- {
- pressed_button = n;
- }
-}
-
-void
-ButtonPanel::on_primary_button_press(int x, int y)
-{
- for(AButtonIter button = a_buttons.begin(); button != a_buttons.end();
button++)
- {
- if ((*button)->is_at(x, y))
- pressed_button = int(button - a_buttons.begin());
- }
-}
-
-bool
-ButtonPanel::is_at (int x, int y)
-{
- for(AButtonIter button = a_buttons.begin(); button != a_buttons.end();
button++)
- {
- if ((*button)->is_at(x, y))
- return true;
- }
- return false;
-}
-
-void
-ButtonPanel::on_primary_button_release(int x, int y)
-{
- UNUSED_ARG(x);
- UNUSED_ARG(y);
-}
-
-/// Select the next action
-void
-ButtonPanel::next_action ()
-{
- pressed_button = (pressed_button + 1) % (int)a_buttons.size();
-}
-
-/// Select the previous action
-void
-ButtonPanel::previous_action ()
-{
- pressed_button = (pressed_button - 1 + (int)a_buttons.size()) %
(int)a_buttons.size();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/button_panel.hpp (from rev 2685,
branches/pingus_sdl/src/components/button_panel.hxx)
Deleted: branches/pingus_sdl/src/components/button_panel.hxx
===================================================================
--- branches/pingus_sdl/src/components/button_panel.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/button_panel.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,83 +0,0 @@
-// $Id: button_panel.hxx,v 1.20 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_BUTTON_PANEL_HXX
-#define HEADER_PINGUS_BUTTON_PANEL_HXX
-
-#include <vector>
-
-#include "action_button.hxx"
-
-class CL_InputEvent;
-
-
-class Client;
-
-class ButtonPanel : public GUI::Component
-{
-private:
- friend class ClientEvent;
-
- Client* client;
- TrueServer* server;
-
- std::vector<ActionButton*> a_buttons;
- typedef std::vector<ActionButton*>::iterator AButtonIter;
- int pressed_button;
-
- int armageddon_pressed;
-
- bool left_pressed;
- unsigned int last_press;
-
- int x_pos, y_pos;
-
- ////CL_Slot wheel_slot;
- ////void on_wheel_move(const CL_InputEvent& key);
-public:
- ButtonPanel(Client* c, int arg_x_pos, int arg_y_pos);
- virtual ~ButtonPanel();
-
- void on_primary_button_press(int x, int y);
- void on_primary_button_release(int x, int y);
-
- bool is_at (int x, int y);
-
- Actions::ActionName get_action_name();
- void update(float delta);
- void draw(DrawingContext& gc);
-
- /// Set n'th action
- void set_button(int);
-
- /// Select the next action
- void next_action ();
-
- /// Select the previous action
- void previous_action ();
-
-private:
- ButtonPanel (const ButtonPanel&);
- ButtonPanel& operator= (const ButtonPanel&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/hurry_up.cpp (from rev 2685,
branches/pingus_sdl/src/components/hurry_up.cxx)
Deleted: branches/pingus_sdl/src/components/hurry_up.cxx
===================================================================
--- branches/pingus_sdl/src/components/hurry_up.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/hurry_up.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,105 +0,0 @@
-// $Id: hurry_up.cxx,v 1.10 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../resource.hxx"
-#include "../fonts.hxx"
-#include "gui/display.hxx"
-#include "hurry_up.hxx"
-
-HurryUp::HurryUp (Client* c)
- : font(Fonts::pingus_large),
- is_running(false),
- is_finished(false),
- center_reached(false),
- client(c),
- wait_counter(0),
- x_pos(-200.0),
- speed(3.0f)
-{
-}
-
-HurryUp::~HurryUp()
-{
-}
-
-
-void
-HurryUp::draw(DrawingContext& gc)
-{
-#ifdef CLANLIB_0_6
- if (is_finished) return;
-
- if (is_running)
- {
- font.print_right(CL_Display::get_width() - static_cast<int>(x_pos),
- CL_Display::get_height()/2 - font->get_height(),
- "Hurry");
- font.print_left(static_cast<int>(x_pos),
- CL_Display::get_height()/2 - font->get_height(),
- "Up");
- }
- UNUSED_ARG(gc);
-#endif
-}
-
-void
-HurryUp::update(float /*delta*/)
-{
- if (is_finished) return;
-
- if (is_running)
- {
- if (center_reached)
- {
- // Wait some secs
- if (static_cast<unsigned int>(wait_counter) < SDL_GetTicks())
- {
- speed *= 1.2f;
- x_pos += speed;
-
- if (x_pos > Display::get_width() + 200)
- is_finished = true;
- }
- }
- else
- {
- x_pos += speed;
- speed *= 1.2f;
-
- if (static_cast<int>(x_pos) > Display::get_width()/2)
- {
- x_pos = (float)Display::get_width()/2;
- center_reached = true;
- wait_counter = SDL_GetTicks() + 2000;
- }
- }
- }
- else if (!is_finished)
- {
- // FIXME: broken
-#if 0
- if ( client->get_server()->get_world()->get_time_left() != -1
- && client->get_server()->get_world()->get_time_left() < 10 * 15)
- is_running = true;
-#endif
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/hurry_up.hpp (from rev 2685,
branches/pingus_sdl/src/components/hurry_up.hxx)
Deleted: branches/pingus_sdl/src/components/hurry_up.hxx
===================================================================
--- branches/pingus_sdl/src/components/hurry_up.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/hurry_up.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,59 +0,0 @@
-// $Id: hurry_up.hxx,v 1.11 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_HURRY_UP_HXX
-#define HEADER_PINGUS_HURRY_UP_HXX
-
-#include "../gui/component.hxx"
-
-#include "../font.hpp"
-
-class DrawingContext;
-class Client;
-
-/** Hurry up if the time goes over... */
-class HurryUp : public GUI::Component
-{
-private:
- Font font;
- bool is_running;
- bool is_finished;
- bool center_reached;
- Client* client;
-
- int wait_counter;
- float x_pos;
-
- float speed;
-
-public:
- HurryUp(Client*);
- virtual ~HurryUp();
-
- void draw(DrawingContext& gc);
- void update(float delta);
- void set_client(Client*);
-
-private:
- HurryUp (const HurryUp&);
- HurryUp& operator= (const HurryUp&);
-};
-
-
-#endif
Copied: branches/pingus_sdl/src/components/menu_button.cpp (from rev 2685,
branches/pingus_sdl/src/components/menu_button.cxx)
Deleted: branches/pingus_sdl/src/components/menu_button.cxx
===================================================================
--- branches/pingus_sdl/src/components/menu_button.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/menu_button.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,161 +0,0 @@
-// $Id: menu_button.cxx,v 1.16 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../globals.hxx"
-#include "../debug.hxx"
-#include "../sound/sound.hxx"
-#include "../resource.hxx"
-#include "../pingus_menu_manager.hxx"
-#include "../gettext.h"
-
-#include "menu_button.hxx"
-
-
-MenuButton::MenuButton(PingusMenu* menu_,
- const Vector2i& pos_, const Sprite& sprite_,
- const std::string& text_, const std::string& desc_)
- : menu(menu_)
-{
- text = text_;
- desc = desc_;
-
- x_pos = pos_.x;
- y_pos = pos_.y;
-
- surface_p = sprite_;
-
- font = Fonts::pingus_small;
- font_large = Fonts::pingus_large;
-
- mouse_over = false;
- pressed = false;
-}
-
-MenuButton::MenuButton ()
-{
- font = Fonts::pingus_small;
- font_large = Fonts::pingus_large;
-
- mouse_over = false;
- pressed = false;
-
- //std::cout << "Generating font cache: " << std::flush;
- // We print all available letters, so that they are in the cache
- //font->print_left (0,0, "!\"#$%&'()*+,-./0123456789:;<=>address@hidden|}~");
- //font_large->print_left (0,0,
"!\"#$%&'()*+,-./0123456789:;<=>address@hidden|}~");
- //std::cout << "done" << std::endl;
-}
-
-MenuButton::~MenuButton ()
-{
-}
-
-void
-MenuButton::on_click ()
-{
- std::cout << "MenuButton: Click" << std::endl;
- menu->on_click(this);
-}
-
-void
-MenuButton::draw (DrawingContext& gc)
-{
- if (mouse_over && !pressed)
- {
- gc.print_center(font, (float)Display::get_width() / 2,
- (float)(Display::get_height() - font.get_height()),
- desc.c_str());
-
- gc.draw(surface_p, Vector3f((float)(x_pos - surface_p.get_width()/2),
- (float)(y_pos - surface_p.get_height()/2)));
-
- gc.print_center(font_large, (float)x_pos + 32,
- (float)(y_pos - 32 - font_large.get_height()/2),
- text);
- }
- else if (mouse_over && pressed)
- {
- float shrink = 0.9f;
-
- gc.print_center(font, (float)Display::get_width() / 2,
- (float)Display::get_height() - 20,
- desc.c_str());
-
- gc.draw(surface_p,
- Vector3f((float)(x_pos - surface_p.get_width()/2 * shrink),
- (float)(y_pos - surface_p.get_height()/2 * shrink)));
-
- gc.print_center(font_large,
- (float)x_pos + 32,
- (float)(y_pos - 32 - font_large.get_height()/2),
- text);
- }
- else
- {
- gc.draw(surface_p,
- Vector3f((float)(x_pos - surface_p.get_width()/2),
- (float)(y_pos - surface_p.get_height()/2)));
- }
- UNUSED_ARG(gc);
-}
-
-void
-MenuButton::update (float delta)
-{
- UNUSED_ARG(delta);
-}
-
-void
-MenuButton::on_pointer_enter ()
-{
- mouse_over = true;
- Sound::PingusSound::play_sound ("tick");
- //std::cout << "X: " << this << "enter" << std::endl;
-}
-
-void
-MenuButton::on_pointer_leave ()
-{
- //std::cout << "X: " << this << "leave" << std::endl;
- mouse_over = false;
-}
-
-void
-MenuButton::on_pointer_press ()
-{
- pressed = true;
-}
-
-void
-MenuButton::on_pointer_release ()
-{
- pressed = false;
-}
-
-bool
-MenuButton::is_at(int x, int y)
-{
- return (x > x_pos - int(surface_p.get_width()) / 2
- && x < x_pos + int(surface_p.get_width()) / 2
- && y > y_pos - int(surface_p.get_height()) / 2
- && y < y_pos + int(surface_p.get_height()) / 2);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/menu_button.hpp (from rev 2685,
branches/pingus_sdl/src/components/menu_button.hxx)
Deleted: branches/pingus_sdl/src/components/menu_button.hxx
===================================================================
--- branches/pingus_sdl/src/components/menu_button.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/menu_button.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,80 +0,0 @@
-// $Id: menu_button.hxx,v 1.8 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_MENU_BUTTON_HXX
-#define HEADER_PINGUS_MENU_BUTTON_HXX
-
-#include <string>
-#include "sprite.hpp"
-#include "font.hpp"
-#include "math/vector2i.hpp"
-#include "../gui/component.hxx"
-
-
-class PingusMenu;
-
-/** Framework for menu buttons */
-class MenuButton : public GUI::Component
-{
-protected:
- PingusMenu* menu;
- Sprite surface_p;
- Font font;
- Font font_large;
-
- int x_pos;
- int y_pos;
-
- std::string desc;
- std::string text;
-
- bool mouse_over;
- bool pressed;
-
- ////CL_Signal_v0 click;
-
-public:
- MenuButton(PingusMenu* menu, const Vector2i& pos, const Sprite& sprite,
- const std::string& text, const std::string& desc);
- MenuButton();
- virtual ~MenuButton();
-
- void draw(DrawingContext& gc);
- void update (float delta);
-
- bool is_at (int x, int y);
-
- void on_pointer_enter ();
- void on_pointer_leave ();
- void on_pointer_press ();
- void on_pointer_release ();
-
- void on_primary_button_click (int x, int y) { on_click (); UNUSED_ARG(x);
UNUSED_ARG(y); }
-
- virtual void on_click ();
- ////CL_Signal_v0& sig_click() { return click; }
-private:
- MenuButton (const MenuButton&);
- MenuButton& operator= (const MenuButton&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/pingus_counter.cpp (from rev 2685,
branches/pingus_sdl/src/components/pingus_counter.cxx)
Deleted: branches/pingus_sdl/src/components/pingus_counter.cxx
===================================================================
--- branches/pingus_sdl/src/components/pingus_counter.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/components/pingus_counter.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,60 +0,0 @@
-// $Id: pingus_counter.cxx,v 1.18 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <stdio.h>
-#include "../gui/display.hxx"
-#include "../gettext.h"
-#include "../resource.hxx"
-#include "../world.hxx"
-#include "../pingu_holder.hxx"
-#include "../true_server.hxx"
-#include "../globals.hxx"
-#include "../fonts.hxx"
-#include "pingus_counter.hxx"
-
-
-PingusCounter::PingusCounter(Server* s)
- : server(s),
- background(Resource::load_sprite("core/buttons/info"))
-{
- font = Fonts::pingus_small_fix_num;
-}
-
-void
-PingusCounter::draw(DrawingContext& gc)
-{
- char str[128];
-
- if (!fast_mode)
- gc.draw(background, Vector3f(gc.get_width()/2, 0));
-
- World* world = server->get_world();
-
- snprintf(str, 128, _("Released:%3d/%-3d Out:%3d Saved:%3d/%-3d"),
- world->get_pingus()->get_number_of_released(),
- world->get_pingus()->get_number_of_allowed(),
- world->get_pingus()->get_number_of_alive(),
- world->get_pingus()->get_number_of_exited(),
- server->get_plf().get_number_to_save());
-
- gc.print_center(font, gc.get_width()/2, 3, str);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/pingus_counter.hpp (from rev 2685,
branches/pingus_sdl/src/components/pingus_counter.hxx)
Deleted: branches/pingus_sdl/src/components/pingus_counter.hxx
===================================================================
--- branches/pingus_sdl/src/components/pingus_counter.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/components/pingus_counter.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,50 +0,0 @@
-// $Id: pingus_counter.hxx,v 1.14 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PINGUS_COUNTER_HXX
-#define HEADER_PINGUS_PINGUS_COUNTER_HXX
-
-#include "../gui/component.hxx"
-#include "../font.hpp"
-#include "../sprite.hpp"
-
-class DrawingContext;
-class World;
-class Server;
-
-class PingusCounter : public GUI::Component
-{
-private:
- Server* server;
- Font font;
- Sprite background;
-public:
- PingusCounter(Server* s);
- virtual ~PingusCounter() {}
-
- void draw(DrawingContext& gc);
-private:
- PingusCounter (const PingusCounter&);
- PingusCounter& operator= (const PingusCounter&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/playfield.cpp (from rev 2685,
branches/pingus_sdl/src/components/playfield.cxx)
Deleted: branches/pingus_sdl/src/components/playfield.cxx
===================================================================
--- branches/pingus_sdl/src/components/playfield.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/playfield.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,252 +0,0 @@
-// $Id: playfield.cxx,v 1.40 2003/10/22 11:11:22 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <stdio.h>
-#include <iostream>
-#include "../globals.hxx"
-#include "../pingu_holder.hxx"
-#include "../display/drawing_context.hxx"
-#include "../display/scene_context.hxx"
-#include "../world.hxx"
-#include "../server.hxx"
-#include "../true_server.hxx"
-#include "../pingu.hxx"
-#include "../gui/display.hxx"
-#include "button_panel.hxx"
-#include "playfield.hxx"
-
-
-Playfield::Playfield (Client* client_, const Rect& rect_)
- : rect(rect_),
- client(client_),
- buttons(client->get_button_panel()),
- current_pingu(0),
- // We keep the SceneContext has member variable so that we don't
- // have to reallocate it every frame, which is quite a costly operation
- scene_context(new SceneContext()),
- state(rect.get_width(), rect.get_height()),
- cap(client->get_button_panel())
-{
- world = client->get_server()->get_world();
- mouse_scrolling = false;
-
- state.set_limit(Rect(Vector2i(0, 0), Size(world->get_width(),
world->get_height())));
-}
-
-Playfield::~Playfield()
-{
- delete scene_context;
-}
-
-void
-Playfield::draw (DrawingContext& gc)
-{
- scene_context->clear();
- scene_context->light().fill_screen(Color(50, 50, 50));
-
- state.push(*scene_context);
-
- cap.set_pingu(current_pingu);
- cap.draw(*scene_context);
-
- // Blank out the entire window in case the screen resolution is larger
- // than the current level.
- gc.draw_fillrect(0, 0, (float)Display::get_width(),
(float)Display::get_height(),
- Color(0,0,0), -15000);
- world->draw(*scene_context);
-
- // Draw the scrolling band
- if (mouse_scrolling && !drag_drop_scrolling)
- {
- gc.draw_line((float)mouse_pos.x, (float)mouse_pos.y,
- (float)scroll_center.x, (float)scroll_center.y-15,
- Color(0, 255, 0));
-
- gc.draw_line((float)mouse_pos.x, (float)mouse_pos.y,
- (float)scroll_center.x, (float)scroll_center.y,
- Color(255, 0, 0));
-
- gc.draw_line((float)mouse_pos.x, (float)mouse_pos.y,
- (float)scroll_center.x, (float)scroll_center.y+15,
- Color(0, 0, 255));
-
- gc.draw_line((float)mouse_pos.x, (float)mouse_pos.y,
- (float)scroll_center.x + 15, (float)scroll_center.y,
- Color(0, 255, 255));
-
- gc.draw_line((float)mouse_pos.x, (float)mouse_pos.y,
- (float)scroll_center.x - 15, (float)scroll_center.y,
- Color(255, 255, 0));
- }
-
- state.pop(*scene_context);
- gc.draw(new SceneContextDrawingRequest(scene_context, Vector3f(0,0,-10000)));
-}
-
-Pingu*
-Playfield::current_pingu_find (const Vector2f& pos)
-{
- double min_dist = 500.0;
- double dist;
- Pingu* c_pingu = 0;
-
- for (PinguIter pingu = world->get_pingus()->begin();
- pingu != world->get_pingus()->end();
- ++pingu)
- {
- if ((*pingu)->is_over(static_cast<int>(pos.x), static_cast<int>(pos.y)))
- {
- dist = (*pingu)->dist(static_cast<int>(pos.x),
static_cast<int>(pos.y));
-
- if (dist < min_dist)
- {
- min_dist = dist;
- c_pingu = *pingu;
- }
- }
- }
- return c_pingu;
-}
-
-void
-Playfield::update(float delta)
-{
- // FIXME: This should be delta dependant
- if (!mouse_scrolling)
- {
- current_pingu = current_pingu_find(state.screen2world(mouse_pos));
- cap.set_pingu(current_pingu);
- }
- else
- {
- if (drag_drop_scrolling)
- {
- state.set_pos(old_state_pos + (scroll_center - mouse_pos));
- }
- else
- {
- state.set_pos(Vector2f(state.get_pos().x - float(scroll_center.x -
mouse_pos.x) * 0.2f,
- state.get_pos().y - float(scroll_center.y -
mouse_pos.y) * 0.2f));
- }
- }
-
- if (auto_scrolling)
- {
- // FIXME: May need to modify this function if it's not gradient enough.
- scroll_speed = static_cast<int>(800 * delta);
- //std::cout << "scroll_speed: " << scroll_speed << std::endl;
-
- if (mouse_pos.x < 10)
- {
- state.set_pos(state.get_pos() - Vector2i(scroll_speed, 0));
- }
- else if (mouse_pos.x > Display::get_width() - 10)
- {
- state.set_pos(state.get_pos() + Vector2i(scroll_speed, 0));
- }
-
- if (mouse_pos.y < 10)
- {
- state.set_pos(state.get_pos() - Vector2i(0, scroll_speed));
- }
- else if (mouse_pos.y > Display::get_height() - 10)
- {
- state.set_pos(state.get_pos() + Vector2i(0, scroll_speed));
- }
- }
-}
-
-void
-Playfield::on_primary_button_press(int x, int y)
-{
- UNUSED_ARG(x);
- UNUSED_ARG(y);
-
- if (current_pingu)
- {
- server->send_pingu_action_event(current_pingu,
buttons->get_action_name());
- }
-}
-
-void
-Playfield::on_secondary_button_press (int x, int y)
-{
- std::cout << "on_secondary_button_press" << std::endl;
- mouse_scrolling = true;
- scroll_center.x = x;
- scroll_center.y = y;
-
- old_state_pos = state.get_pos();
-}
-
-void
-Playfield::on_secondary_button_release (int x, int y)
-{
- std::cout << "on_secondary_button_release" << std::endl;
-
- UNUSED_ARG(x);
- UNUSED_ARG(y);
-
- mouse_scrolling = false;
-}
-
-void
-Playfield::on_pointer_move (int x, int y)
-{
- // FIXME: useless stuff, but currently the controller doesn't have a state
- mouse_pos.x = x;
- mouse_pos.y = y;
-}
-
-void
-Playfield::set_server(Server* s)
-{
- server = s;
-}
-
-Vector2i
-Playfield::get_pos() const
-{
- return Vector2i(static_cast<int>(state.get_pos().x),
- static_cast<int>(state.get_pos().y));
-}
-
-void
-Playfield::set_viewpoint(int x, int y)
-{
- state.set_pos(Vector2f(x, y));
-}
-
-void
-Playfield::generate_clipping_rects(int x1, int y1, int x2, int y2)
-{
- clipping_rectangles.push_back(Rect(0, 0, Display::get_width() - 1, y1));
- clipping_rectangles.push_back(Rect(0, y1, x1, y2+1));
- clipping_rectangles.push_back(Rect(x2+1, y1, Display::get_width() - 1,
y2+1));
- clipping_rectangles.push_back(Rect(0, y2+1, Display::get_width() - 1,
Display::get_height() - 1));
-}
-
-void
-Playfield::scroll (int x, int y)
-{
- state.set_pos(state.get_pos() + Vector2f(x, y));
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/playfield.hpp (from rev 2685,
branches/pingus_sdl/src/components/playfield.hxx)
Deleted: branches/pingus_sdl/src/components/playfield.hxx
===================================================================
--- branches/pingus_sdl/src/components/playfield.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/playfield.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,105 +0,0 @@
-// $Id: playfield.hxx,v 1.17 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PLAYFIELD_HXX
-#define HEADER_PINGUS_PLAYFIELD_HXX
-
-#include "../client.hxx"
-#include "../graphic_context_state.hxx"
-#include "../gui/component.hxx"
-#include "../capture_rectangle.hxx"
-
-class Pingu;
-class World;
-class Server;
-class ButtonPanel;
-class Controller;
-class View;
-
-/** This class encapsulates all the different Views */
-class Playfield : public GUI::Component
-{
-private:
- friend class Client;
-
- Rect rect;
-
- ////CL_Surface buffer;
- Server* server;
- Client* client;
-
- ButtonPanel* buttons;
- World* world;
- View* view;
-
- Pingu* current_pingu;
- bool mouse_scrolling;
- int scroll_speed;
-
- Vector2i scroll_center;
-
- SceneContext* scene_context;
- GraphicContextState state;
- CaptureRectangle cap;
-
- std::vector<Rect> clipping_rectangles;
-
- Vector2i mouse_pos;
- Vector2f old_state_pos;
-public:
- Playfield (Client*, const Rect& rect);
- virtual ~Playfield();
-
- /** Returns the point onto which the Playfield is currently focused
- (ie. center of the Playfield) in WorldCO */
- Vector2i get_pos() const;
-
- void scroll (int x, int y);
-
- void set_viewpoint(int, int);
-
- void draw(DrawingContext& gc);
- void update(float delta);
- Pingu* current_pingu_find(const Vector2f& pos);
-
- void on_primary_button_press (int x, int y);
- void on_secondary_button_press (int x, int y);
- void on_secondary_button_release (int x, int y);
- void on_pointer_move (int x, int y);
-
- void enable_scroll_mode();
- void do_scrolling();
- void disable_scroll_mode();
-
- void generate_clipping_rects(int, int, int, int);
-
- /// Members used to communicate between different screen objs
- void set_server(Server*);
-
- bool is_at (int x, int y) { UNUSED_ARG(x); UNUSED_ARG(y); return true; }
-
-private:
- Playfield (const Playfield&);
- Playfield& operator= (const Playfield&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/smallmap.cpp (from rev 2685,
branches/pingus_sdl/src/components/smallmap.cxx)
Deleted: branches/pingus_sdl/src/components/smallmap.cxx
===================================================================
--- branches/pingus_sdl/src/components/smallmap.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/smallmap.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,193 +0,0 @@
-// $Id: smallmap.cxx,v 1.41 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../pingu_holder.hxx"
-#include "../gui/display.hxx"
-#include "../display/drawing_context.hxx"
-#include "../world.hxx"
-#include "../resource.hxx"
-#include "../col_map.hxx"
-#include "../true_server.hxx"
-#include "../smallmap_image.hxx"
-#include "../pingu.hxx"
-#include "../math.hxx"
-#include "../math/vector3f.hpp"
-#include "../globals.hxx"
-#include "playfield.hxx"
-#include "smallmap.hxx"
-
-
-SmallMap::SmallMap(Client* c)
- : client(c),
- gc_ptr(0)
-{
- int max_width = 175;
- int max_height = 100;
-
- int min_height = 70;
- int min_width = 100;
-
- ColMap* colmap = client->get_server()->get_world()->get_colmap();
-
- // Scaling values used in order to keep the aspect ratio
- int x_scaling = colmap->get_width() / max_width;
- int y_scaling = colmap->get_height() / max_height;
-
- // If at best one horizontal pixel in the smallmap represents more colmap
- // pixels than one vertical pixel
- if (x_scaling > y_scaling)
- {
- width = max_width;
- height = Math::max(min_height, colmap->get_height() / x_scaling);
- }
- else
- {
- width = Math::max(min_width, colmap->get_width() / y_scaling);
- height = max_height;
- }
-
- x_pos = 5;
- y_pos = Display::get_height() - height - 5;
- rwidth = Display::get_width() * width /
client->get_server()->get_world()->get_colmap()->get_width();
- rheight = Display::get_height() * height /
client->get_server()->get_world()->get_colmap()->get_height();
-
- image = new SmallMapImage(c->get_server(), width, height);
-
- scroll_mode = false;
-}
-
-SmallMap::~SmallMap()
-{
- delete image;
-}
-
-void
-SmallMap::draw (DrawingContext& gc)
-{
-#if 0
- // FIXME: This is potentially dangerous, since we don't know how
- // long 'gc' will be alive. Should use a DrawingContext for caching.
- gc_ptr = &gc;
-
- Playfield* playfield = client->get_playfield();
-
- gc.draw(image->get_surface(), Vector3f((float)x_pos, (float)y_pos));
-
- Vector2i of = playfield->get_pos();
-
- of.x = x_pos + of.x * width /
client->get_server()->get_world()->get_colmap()->get_width();
- of.y = y_pos + of.y * height /
client->get_server()->get_world()->get_colmap()->get_height();
-
- int w = Math::min(rwidth, int(width - 1));
- int h = Math::min(rheight, int(height - 1));
-
- gc.draw_rect(float(of.x - w/2), float(of.y - h/2),
- float(of.x + w/2), float(of.y + h/2),
- Color(0, 255, 0));
-
- client->get_server()->get_world()->draw_smallmap(this);
-
- World* const& world = client->get_server()->get_world();
- PinguHolder* pingus = world->get_pingus();
-
- for(PinguIter i = pingus->begin(); i != pingus->end(); ++i)
- {
- int x = static_cast<int>(x_pos + ((*i)->get_x() * width /
world->get_colmap()->get_width()));
- int y = static_cast<int>(y_pos + ((*i)->get_y() * height /
world->get_colmap()->get_height()));
-
- gc.draw_line((float)x, (float)y, (float)x, (float)y-2, Color(255, 255,
0));
- }
-
- gc_ptr = 0;
-#endif
-}
-
-void
-SmallMap::update (float delta)
-{
- image->update(delta);
-}
-
-void
-SmallMap::draw_sprite(Sprite sprite, Vector3f pos)
-{
- World* world = client->get_server()->get_world();
- float x = x_pos + (pos.x * width / world->get_colmap()->get_width());
- float y = y_pos + (pos.y * height / world->get_colmap()->get_height());
-
- gc_ptr->draw(sprite, Vector3f(x, y));
-}
-
-bool
-SmallMap::is_at (int x, int y)
-{
- return (x > x_pos && x < x_pos + (int)width
- && y > y_pos && y < y_pos + (int)height);
-}
-
-void
-SmallMap::on_pointer_move (int x, int y)
-{
- int cx, cy;
- ColMap* colmap = client->get_server()->get_world()->get_colmap();
-
- if (scroll_mode)
- {
- cx = (x - x_pos) * static_cast<int>(colmap->get_width() / width);
- cy = (y - y_pos) * static_cast<int>(colmap->get_height() / height);
-
- client->get_playfield()->set_viewpoint(cx, cy);
- }
-}
-
-void
-SmallMap::on_primary_button_press (int x, int y)
-{
- scroll_mode = true;
-
- // set view to the given COs
- int cx, cy;
- ColMap* colmap = client->get_server()->get_world()->get_colmap();
- cx = (x - x_pos) * int(colmap->get_width()) / width;
- cy = (y - y_pos) * int(colmap->get_height()) / height ;
- client->get_playfield()->set_viewpoint(cx, cy);
-}
-
-void
-SmallMap::on_primary_button_release(int x, int y)
-{
- scroll_mode = false;
- UNUSED_ARG(x);
- UNUSED_ARG(y);
-}
-
-void
-SmallMap::on_pointer_enter ()
-{
- has_focus = true;
-}
-
-void
-SmallMap::on_pointer_leave ()
-{
- has_focus = false;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/smallmap.hpp (from rev 2685,
branches/pingus_sdl/src/components/smallmap.hxx)
Deleted: branches/pingus_sdl/src/components/smallmap.hxx
===================================================================
--- branches/pingus_sdl/src/components/smallmap.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/smallmap.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,107 +0,0 @@
-// $Id: smallmap.hxx,v 1.21 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SMALLMAP_HXX
-#define HEADER_PINGUS_SMALLMAP_HXX
-
-#include "../sprite.hpp"
-#include "../gui/component.hxx"
-
-class Client;
-class Vector3f;
-class SmallMapImage;
-
-/** This is the map that appears in the corner of the screen */
-class SmallMap : public GUI::Component
-{
-private:
- Client* client;
-
- /** Graphic surface of the exit */
- Sprite exit_sur;
-
- /** Graphic surface of the entrance */
- Sprite entrance_sur;
-
- SmallMapImage* image;
-
- /** Horizontal position of the small map */
- int x_pos;
-
- /** Vertical position of the small map */
- int y_pos;
-
- /** Width of the small map */
- int width;
-
- /** Height of the small map */
- int height;
-
- /** Indicates whether the playfield should can be scrolled around depending
- on the position of the cursor in the small map */
- bool scroll_mode;
-
- /** Width of the rectangle displayed inside the small map */
- int rwidth;
-
- /** Height of the rectangle displayed inside the small map */
- int rheight;
-
- bool has_focus;
-
- /** Pointer to the current GC, only valid inside draw() */
- DrawingContext* gc_ptr;
-
-public:
- SmallMap(Client* c);
- virtual ~SmallMap();
-
- /*{ @name Stuff called from the GUIManager */
- void on_primary_button_press(int x, int y);
- void on_primary_button_release(int x, int y);
- void on_pointer_move(int x, int y);
-
- // Events
- void on_pointer_enter ();
- void on_pointer_leave ();
-
- void set_client(Client* c);
-
- bool is_at (int x, int y);
- bool mouse_over();
-
- void draw(DrawingContext& gc);
- void update(float delta);
- /*}*/
-
- /** draws a symbolic sprite onto the smallmap
- @param sprite the Sprite to draw, it will keep its original size
- @param pos the position to draw it in World COs, it will get
- recalculated to screen CO */
- void draw_sprite(Sprite sprite, Vector3f pos);
-
-private:
- SmallMap (const SmallMap&);
- SmallMap& operator= (const SmallMap&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/time_display.cpp (from rev 2685,
branches/pingus_sdl/src/components/time_display.cxx)
Deleted: branches/pingus_sdl/src/components/time_display.cxx
===================================================================
--- branches/pingus_sdl/src/components/time_display.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/time_display.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,69 +0,0 @@
-// $Id: time_display.cxx,v 1.19 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "../gui/display.hxx"
-#include "../globals.hxx"
-#include "../resource.hxx"
-#include "../world.hxx"
-#include "../true_server.hxx"
-#include "../client.hxx"
-#include "../game_time.hxx"
-#include "../fonts.hxx"
-
-#include "time_display.hxx"
-
-
-TimeDisplay::TimeDisplay (Client* c)
- : server(c->get_server()),
- infinity_symbol(Resource::load_sprite("core/misc/infinity"))
-{
- font = Fonts::pingus_small_fix_num;
-}
-
-void
-TimeDisplay::draw (DrawingContext& gc)
-{
- int time_value = server->get_plf().get_time() -
server->get_world()->get_time_passed();
- std::string time_string;
-
- if (server->get_plf().get_time() == -1 && !(pingus_debug_flags &
PINGUS_DEBUG_GAMETIME))
- {
- gc.draw(infinity_symbol, static_cast<float>(Display::get_width()
- -
infinity_symbol.get_width() - 6), 2.0f, 150.0f);
- }
- else
- {
- if (!(pingus_debug_flags & PINGUS_DEBUG_GAMETIME))
- time_string = GameTime::ticks_to_realtime_string(time_value);
- else
- {
- //// time_value = server->get_world()->get_time_passed();
- //// time_string = CL_String::to(time_value);
- }
-
- gc.print_right(font, static_cast<float>(Display::get_width() - 30),
- 3.0f, time_string, 150.0f);
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/components/time_display.hpp (from rev 2685,
branches/pingus_sdl/src/components/time_display.hxx)
Deleted: branches/pingus_sdl/src/components/time_display.hxx
===================================================================
--- branches/pingus_sdl/src/components/time_display.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/components/time_display.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,51 +0,0 @@
-// $Id: time_display.hxx,v 1.14 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_TIME_DISPLAY_HXX
-#define HEADER_PINGUS_TIME_DISPLAY_HXX
-
-#include "../gui/component.hxx"
-
-class Font;
-class Server;
-class Client;
-class DrawingContext;
-
-class TimeDisplay : public GUI::Component
-{
-private:
- Server* server;
- Font font;
- Sprite infinity_symbol;
-
-public:
- TimeDisplay(Client* c);
- virtual ~TimeDisplay() {}
-
- void draw(DrawingContext& gc);
-
-private:
- TimeDisplay (const TimeDisplay&);
- TimeDisplay& operator= (const TimeDisplay&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/config.cpp (from rev 2685,
branches/pingus_sdl/src/config.cxx)
Deleted: branches/pingus_sdl/src/config.cxx
===================================================================
--- branches/pingus_sdl/src/config.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/config.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,413 +0,0 @@
-// $Id: config.cxx,v 1.17 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <stdio.h>
-#include <iostream>
-
-#include "globals.hxx"
-#include "pingus_error.hxx"
-#include "config.hxx"
-#include "system.hxx"
-#include "cheat.hxx"
-#include "gettext.h"
-
-
-struct ConfigParserEOF {};
-
-// Create a PLF object and start parsing the given file
-ConfigParser::ConfigParser()
-{
-}
-
-// Destroy all data
-ConfigParser::~ConfigParser()
-{
-}
-
-void
-ConfigParser::init(std::string filename)
-{
- // Init local vars
- last_atom = ' ';
- lineno = 1;
-
- try {
- // Start parsing
- if (System::exist(filename))
- {
- open(filename);
- parse();
- }
- }
-
- catch (PingusError& err) {
- std::cout << err.get_message () << std::endl;
- }
-}
-
-// Open the file and do some error checking.
-void
-ConfigParser::open(std::string filename)
-{
- in.open(filename.c_str());
- eof = false;
-
- if (!in)
- PingusError::raise(_("Couldn't open: ") + filename);
-
- if (verbose > 1)
- std::cout << "Successfully opened plf file." << std::endl;
-}
-
-// Return the next char from file and check for eof.
-char
-ConfigParser::get_char(void)
-{
- int c;
-
- if (eof) {
- if (verbose > 1) std::cout << "ConfigParser: Result of get_char() will be
undefined" << std::endl;
- PingusError::raise("");
- }
-
- c = in.get();
-
- if (c == EOF) {
- if (verbose > 1) std::cout << "PLF::get_char(): Found EOF!" << std::endl;
- eof = true;
- throw ConfigParserEOF();
- }
-
- if (c == '\n')
- ++lineno;
-
- return c;
-}
-
-// Return the next char from file, remove all comments and spaces before.
-char
-ConfigParser::get_raw_atom(void)
-{
- char c;
- char temp_c;
- c = get_char();
-
- if (c == '#')
- {
- while(get_char() != '\n'); // Ignoring until EOL
-
- if (eof)
- return ' ';
-
- return get_atom();
- }
-
- if (isspace(c))
- {
- temp_c = c;
- while (isspace(c = get_char()));
- in.putback(c);
- if (isspace(last_atom))
- return get_atom();
- return temp_c;
- }
-
- return c;
-}
-
-// Return the next atom and keep it.
-char
-ConfigParser::get_atom(void)
-{
- last_atom = get_raw_atom();
-
- return last_atom;
-}
-
-// Return the name of the value identiver.
-std::string
-ConfigParser::get_valueid(void)
-{
- std::string ret_val;
- char atom;
-
- jump();
-
- while(true)
- {
- atom = get_atom();
-
- if (isgraph(atom) && atom != '=')
- {
- ret_val += atom;
- }
- else if (isspace(atom))
- {
- return ret_val;
- }
- else if (atom == '=')
- {
- in.putback(atom);
- return ret_val;
- }
- else
- {
- syntax_error(std::string(_("Unexpected char: '")) + atom + "'");
- }
- }
-
- return ret_val;
-}
-
-std::string
-ConfigParser::get_value(void)
-{
- std::string ret_val;
- char atom;
-
- jump();
-
- while(true) {
- atom = get_atom();
-
- if (atom == '"' && ret_val == "") {
- while((atom = get_char()) != '"') {
- ret_val += atom;
- }
- return ret_val;
- }
-
- if (atom == ';') {
- in.putback(atom);
- return ret_val;
- }
-
- if (!isalnum(atom) && atom != '-' && atom != '_') {
- if (isspace(atom)){
- return ret_val;
- } else {
- syntax_error(std::string(_("Unexpected char '")) + atom + "'");
- }
- }
-
- ret_val += atom;
- }
-
- return ret_val;
-}
-
-// Jumps to the position of the next token after 'a', no other char's
-// then spaces are allowed before 'a'.
-void
-ConfigParser::jump_after(char c)
-{
- char atom;
-
- jump();
-
- atom = get_atom();
- if (isspace(atom) || atom == c)
- {
- if (atom == c) {
- return;
- } else {
- atom = get_atom();
- if (atom == c)
- return;
- }
- }
- syntax_error(std::string("jump_after(): Expected '") + c + "', got '" + atom
+ "'" );
-}
-
-void
-ConfigParser::jump(void)
-{
- char atom;
- atom = get_atom();
-
- if (isspace(atom)) {
- return;
- } else {
- in.putback(atom);
- }
-}
-
-// Print a error message with lineno and filename.
-void
-ConfigParser::syntax_error(std::string error = "")
-{
- std::string error_str;
- char tmp[16];
-
- snprintf(tmp, 16, "%d\n", lineno);
-
- error_str = std::string("PLF: Syntax Error at line ") + tmp;
-
- if (error != "")
- error_str += "PLF:" + error + "\n";
-
- PingusError::raise(error_str);
-}
-
-// Parse the file and fill all structs with the values.
-void
-ConfigParser::parse(void)
-{
- std::string valueid;
- std::string value;
-
- try
- {
- while(!eof)
- {
- valueid = get_valueid();
- jump_after('=');
- value = get_value();
- jump_after(';');
- set_value(valueid, value);
- }
- }
- catch (ConfigParserEOF)
- {
- }
-}
-
-Config::Config()
-{
-
-}
-
-Config::Config(std::string f)
-{
- filename = f;
- init(filename);
-}
-
-void
-Config::set_value(const std::string& valueid, const std::string& value)
-{
- if (valueid == "fullscreen")
- {
- fullscreen_enabled = str_to_bool(value);
- }
- else if (valueid == "tile-size")
- {
- tile_size = str_to_int(value);
- }
- else if (valueid == "game-speed")
- {
- game_speed = str_to_int(value);
- }
- else if (valueid == "print-fps")
- {
- print_fps = str_to_bool(value);
- }
- else if (valueid == "fast-mode")
- {
- fast_mode = str_to_bool(value);
- }
- else if (valueid == "maintainer-mode")
- {
- maintainer_mode = str_to_bool(value);
- }
- else if (valueid == "unlimited-actions")
- {
- Cheat::unlimited_actions = str_to_bool(value);
- }
- else if (valueid == "cursor-enabled")
- {
- cursor_enabled = str_to_bool(value);
- }
- else if (valueid == "auto-scrolling")
- {
- auto_scrolling = str_to_bool(value);
- }
- else if (valueid == "verbose")
- {
- verbose = str_to_int(value);
- }
- else if (valueid == "width")
- {
- screen_width = str_to_int(value);
- }
- else if (valueid == "height")
- {
- screen_height = str_to_int(value);
- }
- else if (valueid == "sound")
- {
- sound_enabled = str_to_bool(value);
- }
- else if (valueid == "music")
- {
- music_enabled = str_to_bool(value);
- }
- else if (valueid == "swcursor-enabled")
- {
- swcursor_enabled = str_to_bool(value);
- }
- else if (valueid == "username")
- {
- global_username = valueid;
- }
- else if (valueid == "email")
- {
- global_email = valueid;
- }
- else
- {
- PingusError::raise("Config: Unknown valueid: " + valueid);
- }
-}
-
-bool
-Config::str_to_bool(const std::string& str)
-{
- if (str == "true" || str == "1")
- {
- return true;
- }
- else if (str == "false" || str == "0")
- {
- return false;
- }
- else
- {
- PingusError::raise("Config: value: " + str + " is not of type bool.");
- }
-
- return false; // never reached
-}
-
-int
-Config::str_to_int(const std::string& str)
-{
- int ret_val;
-
- if (sscanf(str.c_str(), "%d", &ret_val) != 1)
- {
- PingusError::raise("Config: Couldn't convert std::string to integer: " +
str);
- }
-
- return ret_val;
-}
-
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/config.hpp (from rev 2685,
branches/pingus_sdl/src/config.hxx)
Deleted: branches/pingus_sdl/src/config.hxx
===================================================================
--- branches/pingus_sdl/src/config.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/config.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,93 +0,0 @@
-// $Id: config.hxx,v 1.10 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_CONFIG_HXX
-#define HEADER_PINGUS_CONFIG_HXX
-
-#include "pingus.hxx"
-#include <string>
-#include <fstream>
-
-
-/** FIXME: Rewrite or replace me */
-class ConfigParser
-{
-private:
-
- ///
- std::ifstream in; /// The file to parse
-
- char last_atom; /// The last returned atom
- int lineno; /// Current line number
- bool eof;
- // std::string filename; // The name of the current file
-
- /// private functions
- char get_char(void); /// Return the next char and to a eof check
- char get_atom(void); /// Return the next atom and keep the old one
- char get_raw_atom(void); /// Return the next atom (removes all comments)
- std::string get_valueid(void); /// Return the value identifer
- std::string get_value(void); /// Return the value
- void jump_after(char); /// Jump to the next token, after char
- void jump(void); /// Jump over spaces to the next token
- void syntax_error(std::string); /// Do a clean shutdown on a syntax error
- void parse(void); /// Parse the opened file
- void open(std::string); // Open the file
-
- // Some virtual functions
- /// Put the retrieved value in the correct struct
- virtual void set_value(const std::string& valueid, const std::string& value)
= 0;
-
-public:
- ///
- ConfigParser();
- ///
- ConfigParser(std::string); /// Open the file and parse it
- virtual ~ConfigParser(); /// Close the file
-
- void init(std::string);
-
-private:
- ConfigParser (const ConfigParser&);
- ConfigParser& operator= (const ConfigParser&);
-};
-
-class Config : public ConfigParser
-{
-private:
- std::string filename;
-
- bool str_to_bool(const std::string&);
- int str_to_int(const std::string&);
-
-public:
- Config ();
- Config (std::string);
-
- void set_value(const std::string& valueid, const std::string& value);
-
-private:
- Config (const Config&);
- Config& operator= (const Config&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/console.cpp (from rev 2685,
branches/pingus_sdl/src/console.cxx)
Deleted: branches/pingus_sdl/src/console.cxx
===================================================================
--- branches/pingus_sdl/src/console.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/console.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,254 +0,0 @@
-// $Id: console.cxx,v 1.19 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <config.h>
-#include <assert.h>
-#include "fonts.hxx"
-#include "console.hxx"
-#include "math.hxx"
-
-using std::ostream;
-
-
-// Globale console
-Console console;
-
-ConsoleBuffer::ConsoleBuffer () : buffer(NUM_LINES)
-{
- // Set the output buffer
- setp (char_buffer, char_buffer + CONSOLE_BUFFER_SIZE - 1);
-
- // Switch of input buffer
- setg(0, 0, 0);
-}
-
-ConsoleBuffer::~ConsoleBuffer ()
-{
- sync ();
-}
-
-int
-ConsoleBuffer::overflow (int c)
-{
- std::string str = fill_buffer(true);
-
- str += c;
- buffer.push_back(str);
- buffer.pop_front();
-
- setp (char_buffer, char_buffer + CONSOLE_BUFFER_SIZE - 1);
- return 0;
-}
-
-int
-ConsoleBuffer::sync ()
-{
- std::string str = fill_buffer(false);
-
- if (!str.empty())
- {
- buffer.push_back(str);
- buffer.pop_front();
- }
-
- setp(char_buffer, char_buffer + CONSOLE_BUFFER_SIZE - 1);
- return 0;
-}
-
-std::string
-ConsoleBuffer::fill_buffer (bool append)
-{
- std::string str;
- if (append)
- {
- str = *(--buffer.end());
- buffer.pop_back();
- buffer.push_front("");
- }
-
- for (char* c = pbase (); c != pptr (); ++c)
- {
- if (*c != '\n')
- str += *c;
- else
- {
- if (str.size() > MAX_LINE_LENGTH)
- {
- std::string::size_type pos = str.rfind(' ');
- if (pos == std::string::npos)
- pos = MAX_LINE_LENGTH;
-
- buffer.push_back(str.substr(0, pos));
- buffer.pop_front();
-
- str = str.substr(pos, str.size());
- }
-
- buffer.push_back(str);
- buffer.pop_front();
- str = "";
- }
- }
-
- return str;
-}
-
-const std::list<std::string>&
-ConsoleBuffer::get_buffer () {
- return buffer;
-}
-
-Console::Console() : ostream (&streambuf) // std:: is missing here since Win32
doesn't like it
-{
- is_init = false;
- is_visible = false;
- current_pos = 0;
- number_of_lines = 12;
-
- *this << "================================" << std::endl;
- *this << "Welcome to Pingus " << VERSION << std::endl;
- *this << "================================" << std::endl;
- newline ();
- *this << "This is the output and debug console, you can toggle it with ^" <<
std::endl;
- newline ();
-}
-
-Console::~Console()
-{
-}
-
-// We are not initialising the console in the constructor, 'cause
-// that doesn't work (ClanLib hasn't init the display at that point) void
-void
-Console::init()
-{
- // std::cout << "Console: Init..." << std::endl;
- ////font = Fonts::xterm;
-
- // (*this) << "Pingus Output Console (hide/show it with F1)\n"
- // << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
-
- is_init = true;
-}
-
-// Unload any ClanLib objects that might linger around after we
-// destroy the graphics context
-void
-Console::deinit()
-{
- ////font = CL_Font();
-}
-
-void
-Console::draw()
-{
-#if 0
- assert(is_init);
-
- /** Callculate the position of the first line on the screen */
- ////int start_y_pos =
- //// CL_Display::get_height() - (font.get_height() * (number_of_lines +
3));
-
- // The background of the console
- ////CL_Display::fill_rect(CL_Rect(0, start_y_pos - 15,
- //// CL_Display::get_width(),
- ////CL_Display::get_height()),
- ////Color(0, 0, 0, 128));
-
- const std::list<std::string>& buffer = streambuf.get_buffer ();
-
- unsigned int window_start = Math::max(0, int(buffer.size() - number_of_lines
- current_pos));
-
- std::list<std::string>::const_iterator it = buffer.begin();
-
- // move iterator to the first line to be displayed
- for (unsigned int i = 0; i < window_start; ++i)
- ++it;
-
- for (unsigned int i = 0;
- i < number_of_lines && i + window_start < buffer.size();
- ++it, ++i)
- {
- font.draw(10,
- start_y_pos + (i * (font.get_height() + 2)),
- it->c_str()
- );
- }
-#endif
-}
-
-void
-Console::increase_lines()
-{
- ++number_of_lines;
-}
-
-void
-Console::decrease_lines()
-{
- if (number_of_lines > 0)
- --number_of_lines;
-}
-
-void
-Console::scroll_up()
-{
- if (current_pos + number_of_lines < streambuf.get_buffer().size())
- ++current_pos;
-}
-
-void
-Console::scroll_down()
-{
- if (current_pos)
- --current_pos;
-}
-
-void
-Console::set_lines(int a)
-{
- number_of_lines = a;
-}
-
-int
-Console::get_lines()
-{
- return number_of_lines;
-}
-
-void
-Console::puts(const std::string& str)
-{
- (*this) << str.c_str() << std::endl;
-}
-
-void
-Console::newline()
-{
- (*this) << std::endl;
-}
-
-void
-Console::on_event()
-{
- draw();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/console.hpp (from rev 2685,
branches/pingus_sdl/src/console.hxx)
Deleted: branches/pingus_sdl/src/console.hxx
===================================================================
--- branches/pingus_sdl/src/console.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/console.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,120 +0,0 @@
-// $Id: console.hxx,v 1.16 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_CONSOLE_HXX
-#define HEADER_PINGUS_CONSOLE_HXX
-
-#include <string>
-#include <iostream>
-#include "gui/display.hxx"
-
-
-class ConsoleBuffer :
- public std::streambuf
-{
-private:
-
- enum { CONSOLE_BUFFER_SIZE = 200 };
- enum { NUM_LINES = 100 };
- enum { MAX_LINE_LENGTH = 130 }; // FIXME: this should be dynamic
arcording to the current screen size
-
- std::list<std::string> buffer;
- char char_buffer[CONSOLE_BUFFER_SIZE];
-
-public:
- ConsoleBuffer ();
- virtual ~ConsoleBuffer ();
- int overflow (int c);
- int sync ();
- const std::list<std::string>& get_buffer ();
-
-private:
- /// helper function used by overflow and sync
- std::string fill_buffer (bool append);
-
- ConsoleBuffer (const ConsoleBuffer&);
- ConsoleBuffer& operator= (const ConsoleBuffer&);
-};
-
-/** A "Quake" like console, but it can just handle output, you can't
- type anything. */
-class Console :
- public std::ostream,
- public DisplayHook
-{
-private:
- ConsoleBuffer streambuf;
-
-public:
- ////CL_Font font;
- bool is_init;
- unsigned int current_pos;
-
- /** number of lines which will get displayed on the screen */
- unsigned int number_of_lines;
- void draw();
-public:
- Console ();
- virtual ~Console();
-
- /** Load any gfx or objects that we might need */
- void init();
-
- /** Unload all gfx and objects */
- void deinit();
-
- virtual void on_event();
-
- /** Sets the number of lines, which are displayed
- @param lines The number of lines which are displayed */
- void set_lines(int lines);
-
- /// Returns the height in number of lines, {\em not} in pixels.
- int get_lines();
-
- /** Increase the number of lines, which are displayed */
- void increase_lines();
-
- /** Decrease the number of lines, which are displayed */
- void decrease_lines();
-
- /** Scroll up */
- void scroll_up();
-
- /** Scroll up */
- void scroll_down();
-
- /** Scroll down or up n lines, depending on the sign */
- void scroll (int n);
-
- void puts(const std::string&);
- void newline();
-
-private:
- Console (const Console&);
- Console& operator= (const Console&);
-};
-
-/** The globale console object to which you can send messages */
-extern Console console;
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/credits.cpp (from rev 2685,
branches/pingus_sdl/src/credits.cxx)
Deleted: branches/pingus_sdl/src/credits.cxx
===================================================================
--- branches/pingus_sdl/src/credits.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/credits.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,346 +0,0 @@
-// $Id: credits.cxx,v 1.42 2003/10/31 18:54:40 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "gui/screen_manager.hxx"
-#include "gui/surface_button.hxx"
-#include "gui/gui_manager.hxx"
-#include "sound/sound.hxx"
-#include "stat_manager.hxx"
-#include "resource.hxx"
-#include "res_descriptor.hxx"
-#include "credits.hxx"
-#include "fonts.hxx"
-#include "gettext.h"
-#include "gui/display.hxx"
-
-class CreditsOkButton
- : public GUI::SurfaceButton
-{
-private:
- Credits* parent;
-public:
- CreditsOkButton(Credits* p)
- : GUI::SurfaceButton(Display::get_width()/2 + 225,
- Display::get_height()/2 + 125,
- ResDescriptor("core/start/ok"),
- ResDescriptor("core/start/ok_clicked"),
- ResDescriptor("core/start/ok_hover")),
- parent(p)
- {
- }
-
- void on_pointer_enter ()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound("tick");
- }
-
- void on_click() {
- parent->on_escape_press();
- Sound::PingusSound::play_sound("yipee");
- }
-};
-
-Credits* Credits::instance_ = 0;
-
-Credits::Credits()
-{
- fast_scrolling = false;
- background = Resource::load_sprite("core/menu/startscreenbg");
- pingu = Resource::load_sprite("core/misc/creditpingu");
-
- gui_manager->add(new CreditsOkButton(this), true);
-
- ////background.set_alignment(origin_center);
- ////pingu.set_alignment(origin_center);
-
- font = Fonts::chalk_normal;
- font_small = Fonts::chalk_large;
-
- // The credits vector holds the strings to display. The first
- // character of each string is a special character, which indicates
- // the size of the font or other special stuff. "-" means large
- // font, "_" is a small font and "n" means a newline.
-
- credits.push_back(_("-Idea"));
- credits.push_back("_Ingo Ruhnke");
- credits.push_back("n");
-
- credits.push_back(_("-Maintaining"));
- credits.push_back("_Ingo Ruhnke");
- credits.push_back("n");
-
- credits.push_back(_("-Programming"));
- credits.push_back("_David Philippi");
- credits.push_back("_Gervase Lam");
- credits.push_back("_Ingo Ruhnke");
- credits.push_back("_Jason Green");
- credits.push_back("n");
-
- credits.push_back(_("-Porting (Win32)"));
- credits.push_back("_Alberto Curro");
- credits.push_back("_Bj�rn Christoph Fischer");
- credits.push_back("_Kenneth Gangst�");
- credits.push_back("_Michael K�ser");
- credits.push_back("_Neil Mitchell");
- credits.push_back("_Jason Green");
- credits.push_back("n");
-
- credits.push_back(_("-Porting (MacOSX)"));
- credits.push_back("_Jason Green");
- credits.push_back("_Sean Heber");
- credits.push_back("n");
-
- credits.push_back(_("-Gfx"));
- credits.push_back("_Alan Tennent");
- credits.push_back("_Craig Timpany");
- credits.push_back("_Erik S�e S�rensen");
- credits.push_back("_Ingo Ruhnke");
- credits.push_back("_Jarno Elonen");
- credits.push_back("_Joel Fauche");
- credits.push_back("_Mark Collinson");
- credits.push_back("_Michael Mestre");
- credits.push_back("_Stefan Stiasny");
- credits.push_back("_Tom Flavel");
- credits.push_back("n");
-
- credits.push_back(_("-Music"));
- credits.push_back("_H. Matthew Smith");
- credits.push_back("_Joseph Toscano");
- credits.push_back("_Robbie Ferguson");
- credits.push_back("_Yuri Sucupira");
- credits.push_back("n");
-
- credits.push_back(_("-Level Design"));
- credits.push_back("_Craig Timpany");
- credits.push_back("_Ingo Ruhnke");
- credits.push_back("_Rune Zedeler");
- credits.push_back("n");
-
- credits.push_back(_("-Story"));
- credits.push_back("_Ingo Ruhnke");
- credits.push_back("n");
-
- credits.push_back(_("-Translation"));
- credits.push_back("_Cagri Coltekin");
- credits.push_back("_David Philippi");
- credits.push_back("_Giray Devlet");
- credits.push_back("_Ingo Ruhnke");
- credits.push_back("_Janne Mor�n");
- credits.push_back("_Jarno Elonen");
- credits.push_back("_Milan Babuskov");
- credits.push_back("_Philippe Saint-Pierre");
- credits.push_back("_Ricardo Cruz");
- credits.push_back("_Skule Solvang");
- credits.push_back("_Tomas Blaha");
- credits.push_back("n");
-
- credits.push_back(_("-Special"));
- credits.push_back(_("-Thanks to"));
- credits.push_back("_Adam Gregory");
- credits.push_back("_Andy Balaam");
- credits.push_back("_Bernhard Trummer");
- credits.push_back("_Cagri Coltekin");
- credits.push_back("_David Fauthoux");
- credits.push_back("_David Flores");
- credits.push_back("_David M. Turner");
- credits.push_back("_Debian");
- credits.push_back("_Etienne Marcotte");
- credits.push_back("_Felix Natter");
- credits.push_back("_Francisco 'Pacho' Ramos");
- credits.push_back("_Giray Devlet ");
- credits.push_back("_Giuseppe D'Aqui");
- credits.push_back("_Henri Manson");
- credits.push_back("_Jeff Binder");
- credits.push_back("_Jens Henrik Goebbert");
- credits.push_back("_Jessica Philippi");
- credits.push_back("_John August");
- credits.push_back("_Johnny Taporg");
- credits.push_back("_Jules Bean");
- credits.push_back("_Keir Fraser");
- credits.push_back("_Magnus Norddahl");
- credits.push_back("_Mattias Andersson");
- credits.push_back("_Michael Wand");
- credits.push_back("_Peter Todd");
- credits.push_back("_Peter van Rossum");
- credits.push_back("_Richard Stallman");
- credits.push_back("_Rob Gietema");
- credits.push_back("_Robert Wittams");
- credits.push_back("_Robin Hogan");
- credits.push_back("_Shigeru Miyamoto");
- credits.push_back("_Stefan Ruhnke");
- credits.push_back("_SuSE");
- credits.push_back("_Till Hellweg");
- credits.push_back("_Tim Yamin");
- credits.push_back("_Tuomas (Tigert) Kuosmanen");
- credits.push_back("_Werner Steiner");
- credits.push_back("n");
- credits.push_back("n");
- credits.push_back("n");
- credits.push_back("n");
- credits.push_back("n");
-
- credits.push_back(_("_And a very Special Thanks"));
- credits.push_back(_("_to all the people who"));
- credits.push_back(_("_contribute to"));
- credits.push_back(_("_Free Software!"));
- credits.push_back("n");
- credits.push_back("n");
- credits.push_back("n");
- credits.push_back("n");
- credits.push_back("n");
- credits.push_back(_("_Thank you for"));
- credits.push_back(_("_playing!"));
-
- end_offset = -(float)Display::get_height()/2 - 50; // screen height + grace
time
- for (std::vector<std::string>::iterator i = credits.begin(); i !=
credits.end(); ++i)
- {
- switch ((*i)[0])
- {
- case '-':
- end_offset += font.get_height() + 5;
- break;
- case '_':
- end_offset += font_small.get_height() + 5;
- break;
- case 'n':
- end_offset += 50;
- break;
- default:
- std::cout << "Credits: Syntax error: Unknown format: '" << (*i)[0] <<
"'" << std::endl;
- break;
- }
- }
- end_offset = -end_offset;
-}
-
-Credits::~Credits ()
-{
- StatManager::instance()->set_bool("credits-seen", true);
-}
-
-void
-Credits::update (float delta)
-{
- if (offset < end_offset)
- {
- //ScreenManager::instance()->pop_screen ();
- }
- else
- {
- if (fast_scrolling)
- offset -= 450.0f * delta;
- else
- offset -= 35.0f * delta;
- }
-}
-
-void
-Credits::draw_background (DrawingContext& gc)
-{
- float x;
- float y;
- float yof;
-
- x = (float)Display::get_width()/2;
- y = offset;
-
- gc.draw(background, Vector3f(gc.get_width()/2, gc.get_height()/2));
- gc.draw(pingu, Vector3f(gc.get_width()/2, gc.get_height()/2 - 20));
-
- gc.print_right(Fonts::chalk_normal,
- static_cast<float>(Display::get_width()/2 + 275),
- static_cast<float>(Display::get_height()/2 + 110),
- _("Skip"));
-
- ////Display::push_cliprect(Rect(0, static_cast<int>(gc.get_height()/2-225),
- //// 600, static_cast<int>(gc.get_height()/2+200)));
- yof = 0;
-
- for (std::vector<std::string>::iterator i = credits.begin(); i !=
credits.end(); ++i)
- {
- switch ((*i)[0])
- {
- case '-':
- gc.print_center(font, x, (y + yof), i->substr(1));
- yof += font.get_height() + 5;
- break;
- case '_':
- gc.print_center(font_small, x, (y + yof), i->substr(1));
- yof += font_small.get_height() + 5;
- break;
- case 'n':
- yof += 50;
- break;
- default:
- std::cout << "Credits: Syntax error: Unknown format: '" << (*i)[0] <<
"'" << std::endl;
- break;
- }
- }
- ////Display::pop_cliprect();
-}
-
-void
-Credits::on_startup ()
-{
- offset = (float)Display::get_height() - 50;
- //PingusSound::play_music("pingus-5.it");
-}
-
-Credits*
-Credits::instance ()
-{
- if (instance_)
- return instance_;
- else
- return instance_ = new Credits ();
-}
-
-void
-Credits::init()
-{
- instance_ = 0;
-}
-
-void
-Credits::deinit()
-{
- delete instance_;
- instance_ = 0;
-}
-
-void
-Credits::on_pause_press ()
-{
-}
-
-void
-Credits::on_fast_forward_press ()
-{
- fast_scrolling = ! fast_scrolling;
-}
-
-void
-Credits::on_escape_press ()
-{
- ScreenManager::instance ()->pop_screen ();
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/credits.hpp (from rev 2685,
branches/pingus_sdl/src/credits.hxx)
Deleted: branches/pingus_sdl/src/credits.hxx
===================================================================
--- branches/pingus_sdl/src/credits.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/credits.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,83 +0,0 @@
-// $Id: credits.hxx,v 1.16 2003/10/20 19:28:54 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_CREDITS_HXX
-#define HEADER_PINGUS_CREDITS_HXX
-
-#include <string>
-#include <vector>
-#include "gui/gui_screen.hxx"
-#include "font.hpp"
-#include "sprite.hpp"
-
-class Credits : public GUIScreen
-{
-private:
- static Credits* instance_;
-
- bool fast_scrolling;
- Sprite background;
- Sprite pingu;
-
- Font font;
- Font font_small;
-
- bool is_init;
-
- float end_offset;
- float offset;
-
- /** The string's which are shown in the scrolling text, the first
- character of the string can be used to apply a special format.
-
- 'n' - Inserts a newline
- '_' - Use small font
- '-' - Use large font
- */
- std::vector<std::string> credits;
-
-public:
- Credits ();
- virtual ~Credits ();
-
- static void init();
- static void deinit();
-
- void update (float);
- void draw_background (DrawingContext& gc);
-
- void on_startup ();
-
- static Credits* instance ();
-
- void on_pause_press ();
- void on_fast_forward_press ();
- void on_escape_press ();
-
-
-private:
- Credits (const Credits&);
- Credits& operator= (const Credits&);
-
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/debug.cpp (from rev 2685,
branches/pingus_sdl/src/debug.cxx)
Deleted: branches/pingus_sdl/src/debug.cxx
===================================================================
--- branches/pingus_sdl/src/debug.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/debug.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,33 +0,0 @@
-// $Id: debug.cxx,v 1.2 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "debug.hxx"
-
-
-/* Stream for error messages */
-DebugStream perr("[Error] ");
-
-/* Stream for warnings */
-DebugStream pwarn("[Warning] ");
-
-/* For everything else (temporary stuff only) */
-DebugStream pout ("[Output] ");
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/debug.hpp (from rev 2685,
branches/pingus_sdl/src/debug.hxx)
Deleted: branches/pingus_sdl/src/debug.hxx
===================================================================
--- branches/pingus_sdl/src/debug.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/debug.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,38 +0,0 @@
-// $Id: debug.hxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DEBUG_HXX
-#define HEADER_PINGUS_DEBUG_HXX
-
-#include "debug_stream.hxx"
-
-
-/* Stream for error messages */
-extern DebugStream perr;
-
-/* Stream for warnings */
-extern DebugStream pwarn;
-
-/* Stream for warnings */
-extern DebugStream pout;
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/debug_stream.cpp (from rev 2685,
branches/pingus_sdl/src/debug_stream.cxx)
Deleted: branches/pingus_sdl/src/debug_stream.cxx
===================================================================
--- branches/pingus_sdl/src/debug_stream.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/debug_stream.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,162 +0,0 @@
-// $Id: debug_stream.cxx,v 1.9 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "debug_stream.hxx"
-#include "globals.hxx"
-
-using std::ostream;
-
-
-NilStream DebugStream::nilstream;
-
-DebugStream::Buffer::Buffer (const std::string& p)
- : prefix (p)
-{
- // Set the output buffer
- setp (char_buffer, char_buffer + buffersize - 1);
-
- // Switch of input buffer
- setg(0, 0, 0);
-}
-
-DebugStream::Buffer::~Buffer ()
-{
- sync ();
-}
-
-int
-DebugStream::Buffer::overflow (int c)
-{
- std::string str;
-
- for (char* ptr = pbase (); ptr != pptr (); ++ptr)
- {
- str += *ptr;
-
- if (*ptr == '\n')
- {
- put_line (prefix + str);
- str = "";
- }
- }
- str += c;
- put_line (str);
-
- setp (char_buffer, char_buffer + buffersize - 1);
- return 0;
-}
-
-void
-DebugStream::Buffer::put_line (const std::string& line)
-{
- if (!out_streams.empty ())
- {
- for (std::vector<std::ostream*>::iterator i = out_streams.begin ();
- i != out_streams.end (); ++i)
- {
- *(*i) << line << std::flush;
- }
- }
- else
- {
- std::cout << "[DebugStream::Buffer fallback stream] " << line;
- }
-}
-
-int
-DebugStream::Buffer::sync ()
-{
- std::string str;
-
- // Walk through the buffer
- for (char* c = pbase (); c != pptr (); ++c)
- {
- str += *c;
-
- if (*c == '\n')
- {
- put_line (prefix + str);
- str = "";
- }
- }
-
- if (!str.empty ())
- put_line (str);
-
- setp (char_buffer, char_buffer + buffersize - 1);
- return 0;
-}
-
-void
-DebugStream::Buffer::add (ostream& s)
-{
- out_streams.push_back (&s);
-}
-
-
-void
-DebugStream::Buffer::set_prefix (const std::string & prefix_)
-{
- prefix = prefix_;
-}
-
-
-// ----------------------------------------------------------------
-
-
-DebugStream::DebugStream (const std::string& prefix)
- : ostream (&buffer),
- buffer (prefix)
-{
-}
-
-DebugStream::~DebugStream ()
-{
-}
-
-/// returns self if the debug flag is set, else nilstream
-ostream & DebugStream::operator () (int component) {
-
- if (pingus_debug_flags & component) {
- return *this;
- } else {
- return nilstream;
- }
-}
-
-void
-DebugStream::add (ostream& s)
-{
- buffer.add (s);
-}
-
-void
-DebugStream::set_prefix (const std::string & prefix)
-{
- buffer.set_prefix(prefix);
-}
-
-
-NilStream::NilStream ()
- : ostream(&buffer)
-{
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/debug_stream.hpp (from rev 2685,
branches/pingus_sdl/src/debug_stream.hxx)
Deleted: branches/pingus_sdl/src/debug_stream.hxx
===================================================================
--- branches/pingus_sdl/src/debug_stream.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/debug_stream.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,124 +0,0 @@
-// $Id: debug_stream.hxx,v 1.11 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DEBUG_STREAM_HXX
-#define HEADER_PINGUS_DEBUG_STREAM_HXX
-
-#include "pingus.hxx"
-#include <string>
-#include <vector>
-#include <iostream>
-
-
-class NilStream;
-
-class DebugStream : public std::ostream
-{
-
-private:
-
- class Buffer : public std::streambuf
- {
- private:
-
- enum { buffersize = 1024 };
-
- std::vector<std::ostream*> out_streams;
-
- char char_buffer[buffersize];
- std::string prefix;
-
- public:
-
- Buffer (const std::string& prefix);
- virtual ~Buffer ();
-
- int overflow (int c);
- int sync ();
-
- void add (std::ostream& s);
- void set_prefix (const std::string & prefix_);
-
- private:
-
- void put_line (const std::string& line);
-
- } buffer;
-
- static NilStream nilstream;
-
-public:
-
- DebugStream (const std::string& prefix);
- virtual ~DebugStream ();
-
- std::ostream & operator() (int component);
-
- void add (std::ostream& s);
- void set_prefix (const std::string & prefix);
-
-private:
- DebugStream (const DebugStream&);
- DebugStream& operator= (const DebugStream&);
-};
-
-
-
-/// Stream used to consume unwanted debugmessages
-class NilStream : public std::ostream
-{
- private:
-
- /// Do nothing Buffer for NilStream
- class NilBuffer : public std::streambuf
- {
- private:
-
- char char_buffer[4];
-
- public:
-
- NilBuffer () { setp(char_buffer, char_buffer + 3); setg(0,0,0); }
- ~NilBuffer () { }
-
- int overflow (int) { return 0; }
- int sync () { return 0; }
- } buffer;
-
- NilStream ();
- ~NilStream () { }
-
- NilStream (const NilStream &); ///< not supported
-
- public:
-
- // Avoid unneccessary calls to internal buffer and conversions
- NilStream & operator << (const char *) { return *this; }
- NilStream & operator << (const std::string &) { return *this; }
- NilStream & operator << (int &) { return *this; }
- NilStream & operator << (unsigned int &) { return *this; }
-
-
- friend class DebugStream;
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/delta_manager.hpp (from rev 2685,
branches/pingus_sdl/src/delta_manager.hxx)
Deleted: branches/pingus_sdl/src/delta_manager.hxx
===================================================================
--- branches/pingus_sdl/src/delta_manager.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/delta_manager.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,81 +0,0 @@
-// $Id: delta_manager.hxx,v 1.11 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DELTA_MANAGER_HXX
-#define HEADER_PINGUS_DELTA_MANAGER_HXX
-
-#include "SDL.h"
-#include <assert.h>
-#include <iostream>
-#include "pingus.hxx"
-
-
-class DeltaManager
-{
-private:
- unsigned int absolute_time;
- unsigned int last_time;
-public:
- DeltaManager ()
- : absolute_time(0),
- last_time (SDL_GetTicks())
- {}
-
- float getset ()
- {
- float ret = get ();
- set ();
- return ret;
- }
-
- void set ()
- {
- last_time = SDL_GetTicks();
- absolute_time += last_time;
- }
-
- float get () const
- {
- unsigned int t = SDL_GetTicks();
- if (t < last_time)
- { // catching time travel
- std::cout << "Time Travel: first: " << last_time << " second: " << t
<< std::endl;
- return 0.0f;
- }
- else
- {
- return (SDL_GetTicks() - last_time) / 1000.0f;
- }
- }
-
- /** @return time in miliseconds passed since the start of the DeltaManager */
- unsigned int get_absolute() const
- {
- return absolute_time;
- }
-
-private:
- DeltaManager (const DeltaManager&);
- DeltaManager& operator= (const DeltaManager&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/demo_player.cpp (from rev 2685,
branches/pingus_sdl/src/demo_player.cxx)
Deleted: branches/pingus_sdl/src/demo_player.cxx
===================================================================
--- branches/pingus_sdl/src/demo_player.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/demo_player.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,58 +0,0 @@
-// $Id: demo_player.cxx,v 1.10 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "server.hxx"
-#include "demo_player.hxx"
-#include "xml_pdf.hxx"
-
-
-DemoPlayer::DemoPlayer(Server* s, XMLPDF* pdf)
- : server(s),
- events(pdf->get_events())
-{
-}
-
-DemoPlayer::~DemoPlayer()
-{
-}
-
-void
-DemoPlayer::update()
-{
- while(!events.empty() && events.back().time_stamp == server->get_time())
- {
- ServerEvent& event = events.back();
-
- std::cout << "Sending: ";
- event.write_xml(std::cout);
-
- event.send(server);
- events.pop_back();
- }
-
- // Check for unexpected things (might happen if the demo file is broken)
- if (!events.empty() && events.back().time_stamp < server->get_time())
- {
- std::cout << "DemoPlayer Bug: We missed a timestamp: " <<
events.back().time_stamp << std::endl;
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/demo_player.hpp (from rev 2685,
branches/pingus_sdl/src/demo_player.hxx)
Deleted: branches/pingus_sdl/src/demo_player.hxx
===================================================================
--- branches/pingus_sdl/src/demo_player.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/demo_player.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,50 +0,0 @@
-// $Id: demo_player.hxx,v 1.8 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DEMO_PLAYER_HXX
-#define HEADER_PINGUS_DEMO_PLAYER_HXX
-
-#include <vector>
-#include "server_event.hxx"
-
-
-class Server;
-class XMLPDF;
-
-class DemoPlayer
-{
-private:
- Server* server;
- std::vector<ServerEvent> events;
-
-public:
- DemoPlayer(Server* s, XMLPDF* pdf);
- ~DemoPlayer();
-
- void update();
-
-private:
- DemoPlayer (const DemoPlayer&);
- DemoPlayer& operator= (const DemoPlayer&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/demo_recorder.cpp (from rev 2685,
branches/pingus_sdl/src/demo_recorder.cxx)
Deleted: branches/pingus_sdl/src/demo_recorder.cxx
===================================================================
--- branches/pingus_sdl/src/demo_recorder.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/demo_recorder.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,108 +0,0 @@
-// $Id: demo_recorder.cxx,v 1.20 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <time.h>
-#include <assert.h>
-#include <iostream>
-#include "system.hxx"
-#include "demo_recorder.hxx"
-#include "server.hxx"
-#include "gettext.h"
-
-
-DemoRecorder::DemoRecorder (Server* server)
- : record_demo (true)
-{
- std::string levelname = server->get_plf().get_resname();
- std::string flat_levelname = levelname;
-
- // 'Flatten' the levelname so that we don't need directories
- for (std::string::iterator i = flat_levelname.begin(); i !=
flat_levelname.end(); ++i)
- if (*i == '/')
- *i = '_';
-
- if (!levelname.empty())
- {
- std::string filename = System::get_statdir() + "demos/" + flat_levelname
+ "-" + get_date() + ".xml";
- out.open(filename.c_str());
-
- if (!out)
- {
- record_demo = false;
- std::cout << "DemoRecorder: Error: Couldn't write DemoFile '" <<
filename
- << "', demo recording will be disabled" << std::endl;
- }
- else
- {
- std::cout << "DemoRecorder: Writing demo to: " << filename <<
std::endl;
- record_demo = true;
-
- // Write file header
- out << "<pingus-demo>\n"
- << " <level>" << levelname << "</level>\n"
- << " <events>" << std::endl;
- }
- }
- else
- {
- record_demo = false;
- // This point should only be reachable if we have a bug
- // somewhere or provide a way to get a PLF without using XMLPLF,
- // since we don't do that, a bug must be somewhere when we reach
- // this.
- assert(!"ERROR: DemoRecorder: Couldn't get levelname, please report this
as a bug!");
- }
-}
-
-DemoRecorder::~DemoRecorder ()
-{
- if (record_demo)
- {
- // Write file footer
- out << " </events>\n"
- << "</pingus-demo>" << std::endl;
- out.close();
- }
-}
-
-void
-DemoRecorder::record_event (const ServerEvent& event)
-{
- if (record_demo)
- {
- event.write_xml(out);
- //event.write_xml(std::cout);
- }
-}
-
-std::string
-DemoRecorder::get_date ()
-{
- char buffer[32];
- time_t curtime;
- struct tm *loctime;
- curtime = time (NULL);
- loctime = localtime(&curtime);
- strftime(buffer, 32, "%Y%m%d-%H%M%S", loctime);
-
- return std::string(buffer);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/demo_recorder.hpp (from rev 2685,
branches/pingus_sdl/src/demo_recorder.hxx)
Deleted: branches/pingus_sdl/src/demo_recorder.hxx
===================================================================
--- branches/pingus_sdl/src/demo_recorder.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/demo_recorder.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,59 +0,0 @@
-// $Id: demo_recorder.hxx,v 1.10 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DEMO_RECORDER_HXX
-#define HEADER_PINGUS_DEMO_RECORDER_HXX
-
-#include "pingus.hxx"
-#include <fstream>
-#include <string>
-
-
-class Server;
-class ServerEvent;
-
-class DemoRecorder
-{
-private:
- /** Set to true to record a demo, set to false to ignore
- record_event() messages */
- bool record_demo;
-
- /** Stream to which the events are written */
- std::ofstream out;
-
- /** Filename to which the events are written */
- std::string filename;
-
- std::string get_date();
-public:
- DemoRecorder(Server* server);
- ~DemoRecorder();
-
- void record_event (const ServerEvent& event);
-
-private:
- DemoRecorder (const DemoRecorder&);
- DemoRecorder& operator= (const DemoRecorder&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/demo_session.cpp (from rev 2685,
branches/pingus_sdl/src/demo_session.cxx)
Deleted: branches/pingus_sdl/src/demo_session.cxx
===================================================================
--- branches/pingus_sdl/src/demo_session.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/demo_session.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,116 +0,0 @@
-// $Id: demo_session.cxx,v 1.12 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <ClanLib/Display/keyboard.h>
-#include <ClanLib/Display/keys.h>
-#include "math.hxx"
-#include "xml_pdf.hxx"
-#include "true_server.hxx"
-#include "world.hxx"
-#include "demo_player.hxx"
-#include "components/pingus_counter.hxx"
-#include "gui/gui_manager.hxx"
-#include "display/scene_context.hxx"
-#include "demo_session.hxx"
-
-
-DemoSession::DemoSession(const std::string& filename)
-{
- // Load Demo file
- pdf = new XMLPDF(filename);
-
- // Create server
- server = new TrueServer(pdf->get_plf());
- demo_player = new DemoPlayer(server, pdf);
-
- // Create GUI
- pcounter = new PingusCounter(server);
- gui_manager->add (pcounter, true);
-}
-
-DemoSession::~DemoSession()
-{
- delete server;
- delete pdf;
-}
-
-/** Draw this screen */
-void
-DemoSession::draw_background(DrawingContext& gc)
-{
- World* world = server->get_world();
-
- SceneContext* sc = new SceneContext();
-
- if (CL_Keyboard::get_keycode(CL_KEY_LEFT))
- sc->translate(10.0, 0.0);
-
- if(CL_Keyboard::get_keycode(CL_KEY_RIGHT))
- sc->translate(-10.0, 0.0);
-
- if(CL_Keyboard::get_keycode(CL_KEY_UP))
- sc->translate(0.0, 10.0);
-
- if(CL_Keyboard::get_keycode(CL_KEY_DOWN))
- sc->translate(0.0, -10.0);
-
-#if 0 // FIXME
- float x_of = -sc->get_x_offset();
- float y_of = -sc->get_y_offset();
-
- x_of = Math::mid(sc->get_width()/2.0f,
- x_of,
- world->get_width() - 1 - sc->get_width()/2.0f);
-
- y_of = Math::mid(sc->get_height()/2.0f,
- y_of,
- world->get_height() - 1 - sc->get_height()/2.0f);
-
- sc->set_offset(-x_of, -y_of);
-#endif
-
- world->draw(*sc);
- while (CL_Keyboard::get_keycode(CL_KEY_D))
- {
- world->draw(*sc);
- CL_System::keep_alive();
- }
-}
-
-/** Pass a delta to the screen */
-void
-DemoSession::update(float delta)
-{
- UNUSED_ARG(delta);
-
- // FIXME: Duplicate all timing code here?!
- server->update();
- demo_player->update();
-
- int skip_count = 0;
- while (CL_Keyboard::get_keycode(CL_KEY_SPACE) && skip_count < 10)
- {
- ++skip_count;
- server->update();
- demo_player->update();
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/demo_session.hpp (from rev 2685,
branches/pingus_sdl/src/demo_session.hxx)
Deleted: branches/pingus_sdl/src/demo_session.hxx
===================================================================
--- branches/pingus_sdl/src/demo_session.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/demo_session.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,62 +0,0 @@
-// $Id: demo_session.hxx,v 1.6 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DEMO_SESSION_HXX
-#define HEADER_PINGUS_DEMO_SESSION_HXX
-
-#include "gui/gui_screen.hxx"
-
-
-class Server;
-class XMLPDF;
-class DemoPlayer;
-class PingusCounter;
-
-/** A DemoSession is analog to a GameSession, but instead of loading a
- level and letting the player play a game, a demo file will be
- loaded and the level will be played automatically. */
-class DemoSession : public GUIScreen
-{
-private:
- XMLPDF* pdf;
- Server* server;
- DemoPlayer* demo_player;
-
- // GUI stuff
- PingusCounter* pcounter;
-public:
- /** @param filename the complete filename of the demo file */
- DemoSession(const std::string& filename);
- ~DemoSession();
-
- /** Draw this screen */
- void draw_background(DrawingContext& gc);
-
- /** Pass a delta to the screen */
- void update(float delta);
-
-private:
- DemoSession (const DemoSession&);
- DemoSession& operator= (const DemoSession&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/direction.cpp (from rev 2685,
branches/pingus_sdl/src/direction.cxx)
Deleted: branches/pingus_sdl/src/direction.cxx
===================================================================
--- branches/pingus_sdl/src/direction.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/direction.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,80 +0,0 @@
-// $Id: direction.cxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "direction.hxx"
-
-
-Direction::Direction() : direction(NONE)
-{
-}
-
-Direction::Direction(const Direction& dir)
-{
- direction = dir.direction;
-}
-
-Direction::~Direction()
-{
- // do nothing
-}
-
-Direction&
-Direction::operator=(const Direction& dir)
-{
- if (this != &dir) {
- direction = dir.direction;
- }
- return *this;
-}
-
-void
-Direction::change()
-{
- if (direction == LEFT)
- direction = RIGHT;
- else
- direction = LEFT;
-}
-
-void
-Direction::left()
-{
- direction = LEFT;
-}
-
-void
-Direction::right()
-{
- direction = RIGHT;
-}
-
-bool
-Direction::is_left() const
-{
- return (direction == LEFT);
-}
-
-bool
-Direction::is_right() const
-{
- return direction == RIGHT;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/direction.hpp (from rev 2685,
branches/pingus_sdl/src/direction.hxx)
Deleted: branches/pingus_sdl/src/direction.hxx
===================================================================
--- branches/pingus_sdl/src/direction.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/direction.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,54 +0,0 @@
-// $Id: direction.hxx,v 1.7 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DIRECTION_HXX
-#define HEADER_PINGUS_DIRECTION_HXX
-
-#include "pingus.hxx"
-
-
-/// Simple class for managing the direction of a pingu
-class Direction
-{
-public:
- enum Dir { LEFT = -1, NONE = 0, RIGHT = +1 };
-private:
- Dir direction;
-
-public:
- Direction ();
- Direction (const Direction& dir);
- ~Direction ();
-
- Direction& operator= (const Direction&);
-
- operator int () const { return direction; }
-
- void change ();
- void left ();
- void right ();
-
- bool is_left () const;
- bool is_right () const;
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/drawing_context.cpp (from rev 2685,
branches/pingus_sdl/src/display/drawing_context.cxx)
Deleted: branches/pingus_sdl/src/display/drawing_context.cxx
===================================================================
--- branches/pingus_sdl/src/display/drawing_context.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/drawing_context.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,444 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include <iostream>
-#include <iostream>
-#include "drawing_context.hxx"
-#include "gui/display.hxx"
-#include "../sprite.hpp"
-#include "../font.hpp"
-#include "../math/origin.hpp"
-
-
-struct DrawingRequestsSorter
-{
- bool operator()(DrawingRequest* a, DrawingRequest* b) {
- return a->get_z_pos() < b->get_z_pos();
- }
-};
-
-class FontDrawingRequest : public DrawingRequest
-{
-private:
- Font font;
- std::string text;
- float x;
- float y;
-public:
- FontDrawingRequest(Font font_, Origin origin, const Vector3f& pos, const
std::string& text_, float z)
- : DrawingRequest(Vector3f(pos.x, pos.y, z)),
- font(font_),
- text(text_)
- {
- font.set_alignment(origin);
- }
-
- virtual ~FontDrawingRequest() {}
-
- void draw(SDL_Surface* target) {
- font.draw(static_cast<int>(pos.x), static_cast<int>(pos.y), text, target);
- }
-};
-
-class SpriteDrawingRequest : public DrawingRequest
-{
-private:
- Sprite sprite;
-
-public:
- SpriteDrawingRequest(const Sprite& sprite_, const Vector3f& pos_)
- : DrawingRequest(pos_),
- sprite(sprite_)
- {}
- virtual ~SpriteDrawingRequest() {}
-
- void draw(SDL_Surface* target) {
- sprite.draw(pos.x, pos.y, target);
- }
-};
-
-#if 0
-class FillScreenDrawingRequest : public DrawingRequest
-{
-private:
- CL_Color color;
-public:
- FillScreenDrawingRequest(const CL_Color& color_)
- : DrawingRequest(Vector3f(0, 0, -1000.0f)), color(color_)
- {
- }
- virtual ~FillScreenDrawingRequest() {}
-
- void draw(CL_GraphicContext* gc) {
- gc->clear(color);
- }
-};
-
-class SurfaceDrawingRequest : public DrawingRequest
-{
-private:
- CL_Surface sprite;
-
-public:
- SurfaceDrawingRequest(const CL_Surface& sprite_, const Vector3f& pos_)
- : DrawingRequest(pos_),
- sprite(sprite_)
- {}
- virtual ~SurfaceDrawingRequest() {}
-
- void draw(CL_GraphicContext* gc) {
- sprite.draw(pos.x, pos.y, gc);
- }
-};
-
-class LineDrawingRequest : public DrawingRequest
-{
-private:
- Vector pos1;
- Vector pos2;
- CL_Color color;
-
-public:
- LineDrawingRequest(const Vector& pos1_,
- const Vector& pos2_,
- const CL_Color& color_,
- float z)
- : DrawingRequest(Vector3f(0, 0, z)),
- pos1(pos1_),
- pos2(pos2_),
- color(color_)
- {
- }
-
- void draw(CL_GraphicContext* gc)
- {
- gc->draw_line(pos1.x, pos1.y, pos2.x, pos2.y,
- color);
- }
-};
-
-class RectDrawingRequest : public DrawingRequest
-{
-private:
- CL_Rectf rect;
- CL_Color color;
- bool filled;
-
-public:
- RectDrawingRequest(const CL_Rectf& rect_, const CL_Color& color_, bool
filled_, float z)
- : DrawingRequest(Vector3f(rect.left, rect.top, z)),
- rect(rect_), color(color_), filled(filled_)
- {}
-
- void draw(CL_GraphicContext* gc)
- {
- if (filled)
- gc->fill_rect(rect, color);
- else
- gc->draw_rect(rect, color);
- }
-};
-
-class TextDrawingRequest : public DrawingRequest
-{
-private:
- std::string text;
-public:
- TextDrawingRequest(const std::string& text_, const Vector3f& pos_)
- : DrawingRequest(pos_),
- text(text_)
- {}
- virtual ~TextDrawingRequest() {}
-
- void draw(CL_GraphicContext* gc) {
- // FIXME: not implemented
- }
-};
-
-#endif
-class DrawingContextDrawingRequest : public DrawingRequest
-{
-private:
- DrawingContext* dc;
-
-public:
- DrawingContextDrawingRequest(DrawingContext* dc_, float z)
- : DrawingRequest(Vector3f(0,0,z)),
- dc(dc_)
- {}
-
- virtual ~DrawingContextDrawingRequest()
- {
- delete dc;
- }
-
- void draw(SDL_Surface* screen) {
- dc->render(screen);
- }
-};
-
-DrawingContext::DrawingContext()
-{
- translate_stack.push_back(Vector3f(0, 0));
-}
-
-DrawingContext::~DrawingContext()
-{
- if (drawingrequests.size() > 0)
- clear();
-}
-
-void
-DrawingContext::render(SDL_Surface* screen)
-{
- std::stable_sort(drawingrequests.begin(), drawingrequests.end(),
DrawingRequestsSorter());
-
- if (0)
- {
- std::cout << "<<<<<<<<<<<<<<" << std::endl;
- for(DrawingRequests::iterator i = drawingrequests.begin(); i !=
drawingrequests.end(); ++i)
- std::cout << (*i)->get_z_pos() << std::endl;
- std::cout << ">>>>>>>>>>>>>>" << std::endl;
- }
- for(DrawingRequests::iterator i = drawingrequests.begin(); i !=
drawingrequests.end(); ++i)
- {
- //std::cout << this << ": " << (*i)->get_z_pos() << std::endl;
- (*i)->draw(screen);
- }
-}
-
-void
-DrawingContext::clear()
-{
- for(DrawingRequests::iterator i = drawingrequests.begin(); i !=
drawingrequests.end(); ++i)
- {
- delete *i;
- }
- drawingrequests.clear();
-}
-
-void
-DrawingContext::draw(DrawingRequest* request)
-{
- drawingrequests.push_back(request);
-}
-
-void
-DrawingContext::draw(DrawingContext* dc, float z)
-{
- draw(new DrawingContextDrawingRequest(dc, z));
-}
-
-#if 0
-void
-DrawingContext::draw(const CL_Surface& surface, const Vector& pos)
-{
- draw(new SurfaceDrawingRequest(surface, Vector3f(translate_stack.back().x +
pos.x,
- translate_stack.back().y +
pos.y,
- pos.z)));
-}
-#endif
-
-void
-DrawingContext::draw(const Sprite& sprite, const Vector3f& pos)
-{
- draw(sprite, pos.x, pos.y, pos.z);
-}
-
-void
-DrawingContext::draw(const Sprite& sprite, float x, float y, float z)
-{ // FIXME: This should get flattend down to a simple texture draw
- // command for easier sorting after texture-id/alpha
- draw(new SpriteDrawingRequest(sprite, Vector3f(translate_stack.back().x + x,
- translate_stack.back().y + y,
- z)));
-}
-
-#if 0
-void
-DrawingContext::draw(const std::string& text, float x, float y, float z)
-{
- draw(new TextDrawingRequest(text, Vector3f(x, y, z)));
-}
-#endif
-
-void
-DrawingContext::draw_line (float x1, float y1, float x2, float y2,
- const Color& color, float z)
-{
- //// draw(new LineDrawingRequest(Vector(x1, y1), Vector(x2, y2), color, z));
-}
-
-void
-DrawingContext::draw_fillrect (float x1, float y1, float x2, float y2,
- const Color& color, float z)
-{
-#if 0
- draw(new RectDrawingRequest(CL_Rectf(x1 + translate_stack.back().x, y1 +
translate_stack.back().y,
- x2 + translate_stack.back().x, y2 +
translate_stack.back().y),
- color,
- true,
- z));
-#endif
-}
-
-void
-DrawingContext::draw_rect (float x1, float y1, float x2, float y2,
- const Color& color, float z)
-{
-#if 0
- draw(new RectDrawingRequest(CL_Rectf(x1 + translate_stack.back().x, y1 +
translate_stack.back().y,
- x2 + translate_stack.back().x, y2 +
translate_stack.back().y),
- color,
- false,
- z));
-#endif
-}
-
-void
-DrawingContext::draw_pixel (float x_pos, float y_pos,
- const Color& color)
-{
-}
-
-void
-DrawingContext::draw_circle (float x_pos, float y_pos, float radius,
- const Color& color)
-{
-}
-
-/** Draws an arc, starting from angle_start to angle_end in
- counterclockwise direction. Angles are taken in radian */
-void
-DrawingContext::draw_arc (float x_pos, float y_pos, float radius, float
angle_start, float angle_end,
- const Color& color)
-{
-}
-
-void
-DrawingContext::fill_screen(const Color& color)
-{
- //// draw(new FillScreenDrawingRequest(color));
-}
-
-void
-DrawingContext::rotate(float angel)
-{
- // FIXME: not implemented
-}
-
-void
-DrawingContext::scale(float x, float y)
-{
- // FIXME: not implemented
-}
-
-void
-DrawingContext::translate(float x, float y)
-{
- translate_stack.back().x += x;
- translate_stack.back().y += y;
-}
-
-void
-DrawingContext::push_modelview()
-{
- translate_stack.push_back(translate_stack.back());
-}
-
-void
-DrawingContext::pop_modelview()
-{
- translate_stack.pop_back();
- assert(!translate_stack.empty());
-}
-
-void
-DrawingContext::reset_modelview()
-{
- translate_stack.clear();
- translate_stack.push_back(Vector3f(0, 0));
-}
-
-Rect
-DrawingContext::get_clip_rect() const
-{
- return Rect(Vector2i(static_cast<int>(-translate_stack.back().x),
- static_cast<int>(-translate_stack.back().y)),
- Size((int)get_width(), (int)get_height()));
-}
-float
-DrawingContext::get_width() const
-{
- return (float)Display::get_width();
-}
-
-float
-DrawingContext::get_height() const
-{
- return (float)Display::get_height();
-}
-
-void
-DrawingContext::print_left (const Font& font_, float x_pos, float y_pos, const
std::string& str, float z)
-{
- draw(new FontDrawingRequest(font_,
- origin_top_left,
- Vector3f(x_pos + translate_stack.back().x,
- y_pos + translate_stack.back().y),
- str,
- z));
-}
-
-void
-DrawingContext::print_center (const Font& font_, float x_pos, float y_pos,
const std::string& str, float z)
-{
- draw(new FontDrawingRequest(font_,
- origin_top_center,
- Vector3f(x_pos + translate_stack.back().x,
- y_pos + translate_stack.back().y),
- str,
- z));
-}
-
-void
-DrawingContext::print_right (const Font& font_, float x_pos, float y_pos,
const std::string& str, float z)
-{
- draw(new FontDrawingRequest(font_,
- origin_top_right,
- Vector3f(x_pos + translate_stack.back().x,
- y_pos + translate_stack.back().y),
- str,
- z));
-}
-
-Vector3f
-DrawingContext::screen_to_world (Vector3f pos)
-{
- return pos - Vector3f(translate_stack.back().x, translate_stack.back().y);
-}
-
-Vector3f
-DrawingContext::world_to_screen (Vector3f pos)
-{
- return pos + Vector3f(translate_stack.back().x, translate_stack.back().y);
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/drawing_context.hpp (from rev 2685,
branches/pingus_sdl/src/display/drawing_context.hxx)
Deleted: branches/pingus_sdl/src/display/drawing_context.hxx
===================================================================
--- branches/pingus_sdl/src/display/drawing_context.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/drawing_context.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,136 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_DRAWING_CONTEXT_HXX
-#define HEADER_DRAWING_CONTEXT_HXX
-
-//#include <ClanLib/Core/Math/rect.h>
-//#include <ClanLib/Display/color.h>
-#include "SDL.h"
-#include <vector>
-#include "drawing_request.hxx"
-#include "../math/vector3f.hpp"
-#include "../math/rect.hpp"
-#include "../math/color.hpp"
-
-class Font;
-class Sprite;
-class CL_Surface;
-
-/** The DrawingContext collects all DrawingRequests and allows you to
- flush them all down to the graphics card in one run, this has the
- advantage that it is possible to z-sort, texture-id sort or
- otherwise optimize the drawing. In addition to that it also allows
- you do render the drawing commands to multiple buffers which might
- be usefull for post-processing effects and such. */
-class DrawingContext
-{
-private:
- typedef std::vector<DrawingRequest*> DrawingRequests;
- DrawingRequests drawingrequests;
-
- std::vector<Vector3f> translate_stack;
-
-public:
- DrawingContext();
- virtual ~DrawingContext();
-
- /** Draws everything in the drawing context to the screen */
- void render(SDL_Surface* screen);
-
- /** Empties the drawing context */
- void clear();
-
- /*{ */
- void draw(DrawingRequest* request);
-
- /** Inserts another DrawingContext into the pipeline, translation is
- ignored. DrawingContext ownership is transfered to this
- DrawingContext FIXME: Not such a good feeling with this, but
- worth a try */
- void draw(DrawingContext* dc, float z = 0);
-
- void draw(const Sprite& sprite, const Vector3f& pos);
- void draw(const Sprite& sprite, float x, float y, float z = 0);
-
- /** Fills the screen with a given color, this is different from
- clear() in that it doesn't remove other DrawingRequest from the
- queue */
- void fill_screen(const Color& color);
-
- void draw(const std::string& text, float x, float y, float z = 0);
-
- ////void draw(const CL_Surface& surface, const Vector& pos);
-
- void draw_line (float x1, float y1, float x2, float y2,
- const Color& color, float z = 0);
- void draw_fillrect (float x1, float y1, float x2, float y2,
- const Color& color, float z = 0);
- void draw_rect (float x1, float y1, float x2, float y2,
- const Color& color, float z = 0);
- void draw_pixel (float x_pos, float y_pos,
- const Color& color);
- void draw_circle (float x_pos, float y_pos, float radius,
- const Color& color);
-
- /** Draws an arc, starting from angle_start to angle_end in
- counterclockwise direction. Angles are taken in radian */
- void draw_arc (float x_pos, float y_pos, float radius, float angle_start,
float angle_end,
- const Color& color);
- /*} */
-
- /** Translate the drawing context */
- void translate(float x, float y);
-
- /** Set the rotation of the drawing context */
- void rotate(float angel);
-
- /** Set the scaling of the drawing context */
- void scale(float x, float y);
-
- void push_modelview();
- void pop_modelview();
- void reset_modelview();
-
- /** Return the area of the screen that will be visible*/
- Rect get_clip_rect() const;
-
- float get_width() const;
- float get_height() const;
-
- /** Print a text left aligned */
- void print_left (const Font& font, float x_pos, float y_pos, const
std::string& str, float z = 0.0f);
-
- /** Print a text centred to the given position */
- void print_center (const Font& font, float x_pos, float y_pos, const
std::string& str, float z = 0.0f);
-
- /** Print a text right aligned */
- void print_right (const Font& font, float x_pos, float y_pos, const
std::string& str, float z = 0.0f);
-
- Vector3f screen_to_world (Vector3f pos);
- Vector3f world_to_screen (Vector3f pos);
-
-private:
- DrawingContext (const DrawingContext&);
- DrawingContext& operator= (const DrawingContext&);
-};
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/drawing_request.hpp (from rev 2685,
branches/pingus_sdl/src/display/drawing_request.hxx)
Deleted: branches/pingus_sdl/src/display/drawing_request.hxx
===================================================================
--- branches/pingus_sdl/src/display/drawing_request.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/drawing_request.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,52 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_DRAWING_REQUEST_HXX
-#define HEADER_DRAWING_REQUEST_HXX
-
-#include "SDL.h"
-#include "math/vector3f.hpp"
-
-/**
- */
-class DrawingRequest
-{
-protected:
- Vector3f pos;
-
-public:
- DrawingRequest(const Vector3f& pos_) : pos(pos_) {}
- virtual ~DrawingRequest() {};
-
- virtual void draw(SDL_Surface* gc) = 0;
-
- /** Returns true if the request contains an alpha channel and needs
- to be drawn in order */
- virtual bool has_alpha() { return true; }
-
- /** Returns the position at which the request should be drawn */
- virtual float get_z_pos() { return pos.z; }
-private:
- DrawingRequest (const DrawingRequest&);
- DrawingRequest& operator= (const DrawingRequest&);
-};
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/scene_context.cpp (from rev 2685,
branches/pingus_sdl/src/display/scene_context.cxx)
Deleted: branches/pingus_sdl/src/display/scene_context.cxx
===================================================================
--- branches/pingus_sdl/src/display/scene_context.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/scene_context.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,168 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "gui/display.hxx"
-#include "scene_context.hxx"
-
-#define SCALE_FACTOR 8.0f
-
-
-class SceneContextImpl
-{
-public:
- DrawingContext color;
- DrawingContext light;
- DrawingContext highlight;
-
- SceneContextImpl()
- {
- }
-};
-
-SceneContext::SceneContext()
-{
- impl = new SceneContextImpl();
-}
-
-SceneContext::~SceneContext()
-{
- delete impl;
-}
-
-DrawingContext&
-SceneContext::color()
-{
- return impl->color;
-}
-
-DrawingContext&
-SceneContext::light()
-{
- return impl->light;
-}
-
-DrawingContext&
-SceneContext::highlight()
-{
- return impl->highlight;
-}
-
-
-/** Translate the drawing context */
-void
-SceneContext::translate(float x, float y)
-{
- impl->color.translate(x, y);
- impl->light.translate(x, y);
- impl->highlight.translate(x, y);
-}
-
-/** Set the rotation of the drawing context */
-void
-SceneContext::rotate(float angel)
-{
- impl->color.rotate(angel);
- impl->light.rotate(angel);
- impl->highlight.rotate(angel);
-}
-
-/** Set the scaling of the drawing context */
-void
-SceneContext::scale(float x, float y)
-{
- impl->color.scale(x, y);
- impl->light.scale(x, y);
- impl->highlight.scale(x, y);
-}
-
-void
-SceneContext::push_modelview()
-{
- impl->color.push_modelview();
- impl->light.push_modelview();
- impl->highlight.push_modelview();
-}
-
-void
-SceneContext::pop_modelview()
-{
- impl->color.pop_modelview();
- impl->light.pop_modelview();
- impl->highlight.pop_modelview();
-}
-
-void
-SceneContext::reset_modelview()
-{
- impl->color.reset_modelview();
- impl->light.reset_modelview();
- impl->highlight.reset_modelview();
-}
-
-void
-SceneContext::render(SDL_Surface* target)
-{
- // Render all buffers
- // FIXME: Render all to pbuffer for later combining of them
- impl->color.render(target);
-
-#if 0
- { // lightmap support
- impl->light.render(impl->canvas.get_gc());
- impl->canvas.sync_surface();
-
- //impl->lightmap.set_blend_func(blend_src_alpha, blend_one);
- impl->lightmap.set_blend_func(blend_dest_color, blend_zero);
- //GL_DST_COLOR, GL_ZERO
- impl->lightmap.set_scale(SCALE_FACTOR, SCALE_FACTOR);
- impl->lightmap.draw();
- impl->canvas.get_gc()->clear();
- }
-#endif
-
- impl->highlight.render(target);
-}
-
-void
-SceneContext::clear()
-{
- impl->color.clear();
- impl->light.clear();
- impl->highlight.clear();
-}
-
-SceneContextDrawingRequest::SceneContextDrawingRequest(SceneContext* sc_,
const Vector3f& pos_)
- : DrawingRequest(pos_),
- sc(sc_)
-{
-}
-
-SceneContextDrawingRequest::~SceneContextDrawingRequest()
-{
- //delete sc;
-}
-
-void
-SceneContextDrawingRequest::draw(SDL_Surface* gc)
-{
- sc->render(gc);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/scene_context.hpp (from rev 2685,
branches/pingus_sdl/src/display/scene_context.hxx)
Deleted: branches/pingus_sdl/src/display/scene_context.hxx
===================================================================
--- branches/pingus_sdl/src/display/scene_context.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/scene_context.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,97 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_SCENE_CONTEXT_HXX
-#define HEADER_SCENE_CONTEXT_HXX
-
-#include "SDL.h"
-#include "drawing_context.hxx"
-
-class SceneContextImpl;
-
-/** The SceneContext maintains all the different drawing layers to
- which a game object can draw. Each drawing layer serves a
- different purporse and all are combined in the end to form the
- final image. */
-class SceneContext
-{
-public:
- SceneContext();
- ~SceneContext();
-
- /** The main drawing context, also known as color buffer, to this
- you draw all normal graphics, sprites and enemies, as you would
- do with a normal framebuffer */
- DrawingContext& color();
-
- /** This is the lightmap, to this you draw all lights, meaning that
- a color of white will result in a area that is completly
- visible, while a value of black will mean that the area will be
- not lighted at all and be completly black. This lightmap is
- multiplied with the color buffer to get the light effect */
- DrawingContext& light();
-
- /** The highlight map is usefull for all objects that are extremly
- bright so that they generate a lenseflare or a glow. The
- highlight map doesn't light the scenario itself, but gets
- additionally rendered above the color and light buffer, thus its
- allows to add glow without risking to losing it in an area of
- darkness */
- DrawingContext& highlight();
-
- /** Translate the drawing context */
- void translate(float x, float y);
-
- /** Set the rotation of the drawing context */
- void rotate(float angel);
-
- /** Set the scaling of the drawing context */
- void scale(float x, float y);
-
- void push_modelview();
- void pop_modelview();
- void reset_modelview();
-
- /** Takes all the buffers and combines them to form the final image
- that will be shown on the screen */
- void render(SDL_Surface* gc);
-
- void clear();
-private:
- SceneContextImpl* impl;
-
- SceneContext (const SceneContext&);
- SceneContext& operator= (const SceneContext&);
-};
-
-class SceneContextDrawingRequest : public DrawingRequest
-{
-private:
- SceneContext* sc;
-
-public:
- SceneContextDrawingRequest(SceneContext* sc, const Vector3f& pos_ =
Vector3f(0,0,0));
- virtual ~SceneContextDrawingRequest();
- void draw(SDL_Surface* gc);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/scene_graph.cpp (from rev 2685,
branches/pingus_sdl/src/display/scene_graph.cxx)
Deleted: branches/pingus_sdl/src/display/scene_graph.cxx
===================================================================
--- branches/pingus_sdl/src/display/scene_graph.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/scene_graph.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,107 +0,0 @@
-/* $Id$
-** __ __ __ ___ __ __ __ __
-** / \ / \__| ____ __| _/_______/ |_|__| | | | ____
-** \ \/\/ / |/ \ / __ |/ ___/\ __\ | | | | _/ __ \
-** \ /| | | \/ /_/ |\___ \ | | | | |_| |_\ ___/
-** \__/\ / |__|___| /\____ /____ > |__| |__|____/____/\___ >
-** \/ \/ \/ \/ \/
-** Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-**
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of the GNU General Public License
-** as published by the Free Software Foundation; either version 2
-** of the License, or (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-** 02111-1307, USA.
-*/
-
-#include <SDL.h>
-#include "scene_node.hxx"
-#include "scene_graph.hxx"
-
-extern SDL_Surface* global_screen;
-
-SceneGraph::SceneGraph()
-{
- screen.resize(800/32, 600/32); // could use microtiles instead
-}
-
-SceneGraph::~SceneGraph()
-{
-}
-
-void
-SceneGraph::add(SceneNode* node)
-{
- nodes.push_back(node);
-}
-
-void
-SceneGraph::render()
-{
- for(Nodes::iterator i = nodes.begin(); i != nodes.end(); ++i)
- { // could limit this to stuff that has changed
- (*i)->render(this);
- }
-
- return;
-
-
- screen.clear();
- // Find out what regions of the screen have changed
- for(Nodes::iterator i = nodes.begin(); i != nodes.end(); ++i)
- { // could limit this to stuff that has changed
- (*i)->mark(this);
- }
-
- // Redraw said regions
- for(int y = 0; y < screen.get_height(); ++y)
- for(int x = 0; x < screen.get_width(); ++x)
- {
- if (screen(x, y))
- {
- int width = 1;
-
- // Join cells horizontally
- while(screen(x+width,y)) { width += 1; }
-
- for(Nodes::iterator i = nodes.begin(); i != nodes.end(); ++i)
- { // FIXME: could optimize this to only draw the ones that touch
the region
-
- SDL_Rect clip_rect;
-
- clip_rect.x = x*32;
- clip_rect.y = y*32;
- clip_rect.w = 32*width;
- clip_rect.h = 32;
-
- SDL_SetClipRect(global_screen, &clip_rect);
-
- (*i)->render(this);
- }
-
- x += width;
- }
- }
-}
-
-void
-SceneGraph::mark_screen_region(SceneNode* node, const Rect& rect)
-{
- for(int y = rect.top/32; y < rect.bottom/32; ++y)
- for(int x = rect.left/32; x < rect.left/32; ++x)
- {
- screen(x, y) = true;
- // screen(x, y).push_back(screen_node); bad?
- }
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/scene_graph.hpp (from rev 2685,
branches/pingus_sdl/src/display/scene_graph.hxx)
Deleted: branches/pingus_sdl/src/display/scene_graph.hxx
===================================================================
--- branches/pingus_sdl/src/display/scene_graph.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/scene_graph.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,60 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_SCENE_GRAPH_HPP
-#define HEADER_SCENE_GRAPH_HPP
-
-#define EMPTY_TILE 0x00000000
-#define FULL_TILE 0x00002020
-
-#define MICROTILE(x0, y0, x1, y1) (((x0) << 24) | ((y0) << 16) | ((x1) << 8) |
(y1))
-
-#include <vector>
-#include "../field.hpp"
-
-class Rect;
-class SceneNode;
-
-/** */
-class SceneGraph
-{
-private:
- /** true if the region needs a refresh, false otherwise */
- Field<uint32_t> screen;
-
- typedef std::vector<SceneNode*> Nodes;
- Nodes nodes;
-
-public:
- SceneGraph();
- ~SceneGraph();
-
- void add(SceneNode* );
-
- /** Draw the SceneGraph to the screen */
- void render();
- void mark_screen_region(SceneNode* node, const Rect& rect);
-private:
- SceneGraph (const SceneGraph&);
- SceneGraph& operator= (const SceneGraph&);
-};
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/scene_group.hpp (from rev 2685,
branches/pingus_sdl/src/display/scene_group.hxx)
Deleted: branches/pingus_sdl/src/display/scene_group.hxx
===================================================================
--- branches/pingus_sdl/src/display/scene_group.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/scene_group.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,36 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_SCENE_GROUP_HPP
-#define HEADER_SCENE_GROUP_HPP
-
-/** */
-class Scene_Group
-{
-private:
-public:
-
-private:
- Scene_Group (const Scene_Group&);
- Scene_Group& operator= (const Scene_Group&);
-};
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/scene_node.cpp (from rev 2685,
branches/pingus_sdl/src/display/scene_node.cxx)
Deleted: branches/pingus_sdl/src/display/scene_node.cxx
===================================================================
--- branches/pingus_sdl/src/display/scene_node.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/scene_node.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,36 +0,0 @@
-/* $Id$
-** __ __ __ ___ __ __ __ __
-** / \ / \__| ____ __| _/_______/ |_|__| | | | ____
-** \ \/\/ / |/ \ / __ |/ ___/\ __\ | | | | _/ __ \
-** \ /| | | \/ /_/ |\___ \ | | | | |_| |_\ ___/
-** \__/\ / |__|___| /\____ /____ > |__| |__|____/____/\___ >
-** \/ \/ \/ \/ \/
-** Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-**
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of the GNU General Public License
-** as published by the Free Software Foundation; either version 2
-** of the License, or (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-** 02111-1307, USA.
-*/
-
-#include "scene_node.hxx"
-
-SceneNode::SceneNode()
-{
-}
-
-SceneNode::~SceneNode()
-{
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/scene_node.hpp (from rev 2685,
branches/pingus_sdl/src/display/scene_node.hxx)
Deleted: branches/pingus_sdl/src/display/scene_node.hxx
===================================================================
--- branches/pingus_sdl/src/display/scene_node.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/scene_node.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,50 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_SCENE_NODE_HPP
-#define HEADER_SCENE_NODE_HPP
-
-#include "../math/rect.hpp"
-
-class SceneGraph;
-
-/** */
-class SceneNode
-{
-private:
-public:
- SceneNode();
- virtual ~SceneNode();
-
- /** Return the area that the SceneNode covers on the screen */
- virtual Rect get_screen_rect() const =0;
-
- /** Mark regions for update */
- virtual void mark(SceneGraph* graph) =0;
-
- virtual void render(SceneGraph* graph) =0;
-
-private:
- SceneNode (const SceneNode&);
- SceneNode& operator= (const SceneNode&);
-};
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/scene_test.cpp (from rev 2685,
branches/pingus_sdl/src/display/scene_test.cxx)
Deleted: branches/pingus_sdl/src/display/scene_test.cxx
===================================================================
--- branches/pingus_sdl/src/display/scene_test.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/scene_test.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,65 +0,0 @@
-#include <SDL.h>
-#include <SDL_image.h>
-#include <stdlib.h>
-#include <iostream>
-#include "scene_graph.hxx"
-#include "sprite_node.hxx"
-
-SDL_Surface* global_screen;
-
-int main()
-{
- if(SDL_Init(SDL_INIT_VIDEO) < 0) {
- std::cerr << "Unable to init SDL: " << SDL_GetError() << std::endl;
- exit(1);
- }
- atexit(SDL_Quit);
-
-
- global_screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);
-
- SDL_Event event;
-
- SDL_Surface* surface =
IMG_Load("/home/ingo/projects/pingus/svn/trunk/data/images/pingus/player0/tumble.png");
-
- SceneGraph graph;
- SpriteNode* sprite = new
SpriteNode("/home/ingo/projects/pingus/svn/trunk/data/images/pingus/player0/tumble.png");
- graph.add(sprite);
-
- sprite->set_pos(Point(100, 100));
-
- while(1)
- {
- while(SDL_PollEvent(&event))
- {
- switch (event.type)
- {
- case SDL_KEYDOWN:
- std::cout << "Keypress" << std::endl;
- break;
-
- case SDL_QUIT:
- exit(EXIT_SUCCESS);
- break;
- }
- }
-
- sprite->set_pos(Point(rand()%800, rand()%600));
-
- graph.render();
- {
- SDL_Rect rect;
- rect.x = 320;
- rect.y = 200;
- SDL_BlitSurface(surface, NULL, global_screen, &rect);
- }
-
- SDL_Flip(global_screen);
-
- std::cout << "." << std::endl;
- SDL_Delay(100);
- }
-}
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/display/sprite_node.cpp (from rev 2685,
branches/pingus_sdl/src/display/sprite_node.cxx)
Deleted: branches/pingus_sdl/src/display/sprite_node.cxx
===================================================================
--- branches/pingus_sdl/src/display/sprite_node.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/sprite_node.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,152 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <SDL.h>
-#include <SDL_image.h>
-#include <string>
-#include "scene_graph.hxx"
-#include "sprite_node.hxx"
-
-extern SDL_Surface* global_screen;
-
-SpriteNode::SpriteNode(const std::string resourcename)
-{
- surface = IMG_Load(resourcename.c_str());
-}
-
-SpriteNode::~SpriteNode()
-{
- SDL_FreeSurface(surface);
-}
-
-void
-SpriteNode::set_pos(const Point& pos_)
-{
- if (pos != pos_) has_changed_ = true;
- pos = pos_;
-}
-
-Point
-SpriteNode::get_pos() const
-{
- return pos;
-}
-
-void
-SpriteNode::render(SceneGraph* graph)
-{
- SDL_Rect dest;
-
- dest.x = pos.x;
- dest.y = pos.y;
-
- SDL_BlitSurface(surface, NULL, global_screen, &dest);
-
- has_changed_ = false;
- old_repeat = repeat;
- old_pos = pos;
-}
-
-Rect
-SpriteNode::get_old_screen_rect() const
-{
- return Rect(old_pos.x - (old_repeat.left * surface->w),
- old_pos.y - (old_repeat.top * surface->h),
- surface->w * (old_repeat.left + old_repeat.right + 1),
- surface->h * (old_repeat.top + old_repeat.bottom + 1));
-}
-
-Rect
-SpriteNode::get_screen_rect() const
-{
- return Rect(pos.x - (repeat.left * surface->w),
- pos.y - (repeat.top * surface->h),
- surface->w * (repeat.left + repeat.right + 1),
- surface->h * (repeat.top + repeat.bottom + 1));
-}
-
-bool
-SpriteNode::has_changed() const
-{
- return has_changed_;
-}
-
-void
-SpriteNode::mark(SceneGraph* graph)
-{
- if (has_changed_)
- {
- graph->mark_screen_region(this, get_old_screen_rect());
- graph->mark_screen_region(this, get_screen_rect());
- }
-}
-
-void
-SpriteNode::set_left_repeat(int left)
-{
- if (left != repeat.left) has_changed_ = true;
- repeat.left = left;
-}
-
-void
-SpriteNode::set_right_repeat(int right)
-{
- if (right != repeat.right) has_changed_ = true;
- repeat.right = right;
-}
-
-void
-SpriteNode::set_top_repeat(int top)
-{
- if (top != repeat.top) has_changed_ = true;
- repeat.top = top;
-}
-
-void
-SpriteNode::set_bottom_repeat(int bottom)
-{
- if (bottom != repeat.bottom) has_changed_ = true;
- repeat.bottom = bottom;
-}
-
-int
-SpriteNode::get_left_repeat(int left) const
-{
- return repeat.left;
-}
-
-int
-SpriteNode::get_right_repeat(int right) const
-{
- return repeat.right;
-}
-
-int
-SpriteNode::get_top_repeat(int top) const
-{
- return repeat.top;
-}
-
-int
-SpriteNode::get_bottom_repeat(int bottom) const
-{
- return repeat.bottom;
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/display/sprite_node.hpp (from rev 2685,
branches/pingus_sdl/src/display/sprite_node.hxx)
Deleted: branches/pingus_sdl/src/display/sprite_node.hxx
===================================================================
--- branches/pingus_sdl/src/display/sprite_node.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/display/sprite_node.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,64 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../math/point.hpp"
-#include "scene_node.hxx"
-
-class SpriteNode : public SceneNode
-{
-private:
- Point pos;
- Rect repeat;
-
- Point old_pos;
- Rect old_repeat;
-
- SDL_Surface* surface;
- bool has_changed_;
-
-public:
- SpriteNode(const std::string resourcename);
- ~SpriteNode();
-
- bool has_changed() const;
- Rect get_screen_rect() const;
- Rect get_old_screen_rect() const;
-
- void mark(SceneGraph* graph);
-
- void set_pos(const Point& pos);
- Point get_pos() const;
-
- void set_left_repeat(int left);
- void set_right_repeat(int right);
-
- void set_top_repeat(int top);
- void set_bottom_repeat(int bottom);
-
- int get_left_repeat(int left) const;
- int get_right_repeat(int right) const;
-
- int get_top_repeat(int top) const;
- int get_bottom_repeat(int bottom) const;
-
- /** Draw the SDL_Surface to the screen */
- void render(SceneGraph* graph);
-};
-
-/* EOF */
Copied: branches/pingus_sdl/src/dummy_screen.hpp (from rev 2685,
branches/pingus_sdl/src/dummy_screen.hxx)
Deleted: branches/pingus_sdl/src/dummy_screen.hxx
===================================================================
--- branches/pingus_sdl/src/dummy_screen.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/dummy_screen.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,52 +0,0 @@
-// $Id: screen.hxx,v 1.4 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DUMMY_SCREEN_HXX
-#define HEADER_PINGUS_DUMMY_SCREEN_HXX
-
-#include "gui/screen.hxx"
-
-
-class DrawingContext;
-
-/** DummyScreen without any actual functionality, just for testing */
-class DummyScreen : public Screen
-{
-private:
-
-public:
- DummyScreen () { }
- virtual ~DummyScreen () {}
-
- /** Draw this screen @return true if draw was successfull, false if
- frameskip has taken place ('causes a skip of flip_display) */
- bool draw (DrawingContext& gc) { return 0; }
-
- /** Pass a delta to the screen */
- void update (const GameDelta& delta) {}
-
-private:
- DummyScreen (const DummyScreen&);
- DummyScreen& operator= (const DummyScreen&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/context_menu.cpp (from rev 2685,
branches/pingus_sdl/src/editor/context_menu.cxx)
Deleted: branches/pingus_sdl/src/editor/context_menu.cxx
===================================================================
--- branches/pingus_sdl/src/editor/context_menu.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/context_menu.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,244 +0,0 @@
-// $Id: context_menu.cxx,v 1.00 2005/12/29 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "context_menu.hxx"
-#include "level_objs.hxx"
-#include "editor_viewport.hxx"
-#include "editor_screen.hxx"
-#include "../gui/gui_manager.hxx"
-#include "../fonts.hxx"
-
-namespace Editor {
-
- // Determine which actions are available for these objects
- ContextMenu::ContextMenu(std::vector<LevelObj*> o, Vector3f p,
EditorViewport* vp, bool base_menu)
- : objs(o),
- viewport(vp),
- pos(p),
- selected_action_offset(0),
- displayed_child(0),
- item_height(Fonts::pingus_small.get_height())
- {
- if (base_menu)
- {
- // Create all available child menus
- width = 110;
- show = true;
- create_child_menus();
- }
- else
- {
- width = 200;
- show = false;
- }
-
- total_height = item_height * actions.size();
- }
-
-
- ContextMenu::~ContextMenu()
- {
- for (unsigned i = 0; i < actions.size(); i++)
- if (actions[i].child)
- delete actions[i].child;
- }
-
-
- // Keep track of where the mouse is for highlighting
- void
- ContextMenu::on_pointer_move(int x, int y)
- {
- mouse_at.x = (float)x;
- mouse_at.y = (float)y;
-
- selected_action_offset = (unsigned)((mouse_at.y - pos.y) /
item_height);
- }
-
- void
- ContextMenu::draw(DrawingContext &gc)
- {
- if (show)
- {
- // Draw the box
- gc.draw_fillrect(pos.x, pos.y, pos.x + width, pos.y +
total_height,
- Color(211,211,211,100));
- // Draw the border
- gc.draw_rect(pos.x, pos.y, pos.x + width, pos.y +
total_height,
- Color(0,0,0));
- // Draw the highlighted action if the mouse is in the
box
- if (hover)
- {
- gc.draw_fillrect(pos.x, pos.y +
selected_action_offset *
- item_height, pos.x + width, pos.y +
(selected_action_offset + 1) * item_height,
- Color(128,128,128,150));
- }
-
- // Draw the action names
- for (unsigned i = 0; i < actions.size(); i++)
- gc.print_left(Fonts::pingus_small, pos.x, pos.y
+
- (i * item_height),
actions[i].friendly_name);
- }
- }
-
- bool
- ContextMenu::is_at(int x, int y)
- {
- if (show)
- return (x > pos.x && x < pos.x + width &&
- y > pos.y && y < pos.y + total_height);
- else
- return false;
- }
-
- void
- ContextMenu::on_primary_button_click(int x, int y)
- {
- if (!actions[selected_action_offset].child)
- {
- for (unsigned i = 0; i < objs.size(); i++)
- {
- switch
(actions[selected_action_offset].modifier)
- {
- case (REMOVE) :
- objs[i]->remove();
- break;
- case (ROTATE) :
-
objs[i]->set_modifier(actions[selected_action_offset].parameter);
- break;
- case (SET_OWNER) :
-
////objs[i]->set_owner(CL_String::to_int(actions[selected_action_offset].parameter));
- break;
- case (SET_DIRECTION) :
-
objs[i]->set_direction(actions[selected_action_offset].parameter);
- break;
- case (SET_Z_POS) :
-
////objs[i]->set_pos(Vector3f(objs[i]->get_pos().x, objs[i]->get_pos().y,
- ////
(float)CL_String::to_int(actions[selected_action_offset].parameter)));
-
objs[i]->set_orig_pos(objs[i]->get_pos());
- break;
- default :
- break;
- }
- }
- viewport->remove_context_menu();
- }
- }
-
- void
- ContextMenu::on_secondary_button_click(int x, int y)
- {
- // Does the same as the primary button
- on_primary_button_click(x, y);
- }
-
- void
- ContextMenu::create_child_menus()
- {
- // Create Remove button - available to all objects
- actions.push_back(ContextItem("Remove", "", REMOVE, 0));
-
- // Determine which actions are available to the selected objects
- unsigned available_attribs = 0xffff;
- for (unsigned i = 0; i < (unsigned)objs.size(); i++)
- available_attribs = available_attribs &
objs[i]->get_attribs();
-
- ContextMenu* menu;
- if (available_attribs & CAN_ROTATE)
- {
- menu = new ContextMenu(objs, Vector3f(pos.x + width,
pos.y), viewport, false);
- viewport->get_screen()->get_gui_manager()->add(menu,
true);
- menu->add_action(ContextItem("0 degrees", "ROT0",
ROTATE, 0));
- menu->add_action(ContextItem("90 Degrees", "ROT90",
ROTATE, 0));
- menu->add_action(ContextItem("180 Degrees", "ROT180",
ROTATE, 0));
- menu->add_action(ContextItem("270 Degrees", "ROT270",
ROTATE, 0));
- menu->add_action(ContextItem("0 Degrees + Flip",
"ROT0FLIP", ROTATE, 0));
- menu->add_action(ContextItem("90 Degrees + Flip",
"ROT90FLIP", ROTATE, 0));
- menu->add_action(ContextItem("180 Degrees + Flip",
"ROT180FLIP", ROTATE, 0));
- menu->add_action(ContextItem("270 Degrees + Flip",
"ROT270FLIP", ROTATE, 0));
- add_action(ContextItem("Rotate >", "", ROTATE, menu));
- }
- if (available_attribs & HAS_OWNER)
- {
- menu = new ContextMenu(objs, Vector3f(pos.x + width,
pos.y), viewport, false);
- viewport->get_screen()->get_gui_manager()->add(menu,
true);
- menu->add_action(ContextItem("0", "0", SET_OWNER, 0));
- menu->add_action(ContextItem("1", "1", SET_OWNER, 0));
- menu->add_action(ContextItem("2", "2", SET_OWNER, 0));
- menu->add_action(ContextItem("3", "3", SET_OWNER, 0));
- add_action(ContextItem("Set Owner >", "", SET_OWNER,
menu));
- }
- if (available_attribs & HAS_DIRECTION)
- {
- menu = new ContextMenu(objs, Vector3f(pos.x + width,
pos.y), viewport, false);
- viewport->get_screen()->get_gui_manager()->add(menu,
true);
- menu->add_action(ContextItem("Left", "left",
SET_DIRECTION, 0));
- menu->add_action(ContextItem("Right", "right",
SET_DIRECTION, 0));
- menu->add_action(ContextItem("Misc.", "misc",
SET_DIRECTION, 0));
- add_action(ContextItem("Direction >", "",
SET_DIRECTION, menu));
- }
- menu = new ContextMenu(objs, Vector3f(pos.x + width, pos.y),
viewport, false);
- viewport->get_screen()->get_gui_manager()->add(menu, true);
- menu->add_action(ContextItem("-50", "-50", SET_Z_POS, 0));
- menu->add_action(ContextItem("-25", "-25", SET_Z_POS, 0));
- menu->add_action(ContextItem("0", "0", SET_Z_POS, 0));
- menu->add_action(ContextItem("25", "25", SET_Z_POS, 0));
- menu->add_action(ContextItem("50", "50", SET_Z_POS, 0));
- add_action(ContextItem("Set Z Pos. >", "", SET_Z_POS, menu));
-
- // TODO - Add more menu options here
- }
-
- void
- ContextMenu::add_action(ContextItem item)
- {
- actions.push_back(item);
- total_height += item_height;
- }
-
- void
- ContextMenu::display(bool should_display)
- {
- show = should_display;
- if (!show && displayed_child)
- displayed_child->display(false);
- }
-
- void
- ContextMenu::update(float delta)
- {
- UNUSED_ARG(delta);
-
- if (displayed_child != actions[selected_action_offset].child)
- {
- if (displayed_child)
- {
- displayed_child->display(false);
- displayed_child = 0;
- }
- if (actions[selected_action_offset].child)
- {
- displayed_child =
actions[selected_action_offset].child;
- displayed_child->display(true);
- }
- }
- }
-
-} // Editor namespace
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/context_menu.hpp (from rev 2685,
branches/pingus_sdl/src/editor/context_menu.hxx)
Deleted: branches/pingus_sdl/src/editor/context_menu.hxx
===================================================================
--- branches/pingus_sdl/src/editor/context_menu.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/context_menu.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,127 +0,0 @@
-// $Id: context_menu.hxx,v 1.00 2005/12/29 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_EDITOR_CONTEXT_MENU_HXX
-#define HEADER_PINGUS_EDITOR_CONTEXT_MENU_HXX
-
-#include <vector>
-#include <string>
-#include "../math/vector3f.hpp"
-#include "../gui/component.hxx"
-
-namespace Editor {
-
- class LevelObj;
- class EditorViewport;
- class ContextMenu;
-
- typedef enum ItemModifier { REMOVE, ROTATE, SET_OWNER, SET_DIRECTION,
- STRETCH, SET_Z_POS };
-
- class ContextItem {
- public:
- std::string friendly_name;
- std::string parameter;
- ItemModifier modifier;
- ContextMenu* child;
-
- public:
- ContextItem(std::string friendly_name_, std::string parameter_,
ItemModifier mod,
- ContextMenu* child_menu)
- : friendly_name(friendly_name_),
- parameter(parameter_),
- modifier(mod),
- child(child_menu)
- { }
- };
-
- class ContextMenu : public GUI::Component {
- private:
- /** Creates the child menu structure and detemines which
actions are available */
- void create_child_menus();
-
- /** Level objects to be affected by this menu */
- std::vector<LevelObj*> objs;
-
- /** Viewport to which this menu belongs */
- EditorViewport* viewport;
-
- /** List of actions available in this menu */
- std::vector<ContextItem> actions;
-
- /** Where the mouse is located */
- Vector3f mouse_at;
-
- /** Location of context menu */
- Vector3f pos;
-
- /** Is the mouse over the menu? */
- bool hover;
-
- /** Should this be showing? */
- bool show;
-
- /** The offset into actions vector of the currently highlighted
action */
- unsigned selected_action_offset;
-
- /** Currently displayed child menu (if any) */
- ContextMenu* displayed_child;
-
- /** Height of a single action */
- unsigned item_height;
-
- unsigned total_height;
- unsigned width;
-
- public:
- // Constructor
- ContextMenu (std::vector<LevelObj*>, Vector3f p,
EditorViewport* v, bool base_menu = true);
-
- // Desctructor
- ~ContextMenu ();
-
- /** Add an action to the list */
- void add_action(ContextItem item);
-
- void display (bool should_display);
-
- /// GUI Component Functions
- bool is_at(int x, int y);
- void draw (DrawingContext& gc);
- void update (float delta);
- void on_pointer_move (int x, int y);
- void on_primary_button_click(int x, int y);
- void on_secondary_button_click(int x, int y);
- void on_pointer_enter () { hover = true; }
- void on_pointer_leave () { hover = false; }
-
-
-
- private:
- ContextMenu ();
- ContextMenu (const ContextMenu&);
- ContextMenu& operator= (const ContextMenu&);
-
- }; // ContextMenu class
-
-} // Editor namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/editor_panel.cpp (from rev 2685,
branches/pingus_sdl/src/editor/editor_panel.cxx)
Deleted: branches/pingus_sdl/src/editor/editor_panel.cxx
===================================================================
--- branches/pingus_sdl/src/editor/editor_panel.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/editor_panel.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,173 +0,0 @@
-// $Id: editor_panel.cxx,v 1.00 2005/11/07 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <vector>
-#include "../resource.hxx"
-#include "../gui/display.hxx"
-#include "../math/vector3f.hpp"
-#include "../display/drawing_context.hxx"
-#include "../gui/gui_manager.hxx"
-#include "../gui/checkbox.hxx"
-#include "../gui/combobox.hxx"
-#include "../fonts.hxx"
-#include "editor_panel.hxx"
-#include "editor_screen.hxx"
-#include "editor_viewport.hxx"
-#include "panel_buttons.hxx"
-
-
- class GUI::Component;
-
-namespace Editor {
-
-// Constructor
-EditorPanel::EditorPanel(EditorScreen* es)
-: editor(es),
- pressed_button(0),
- combobox_1(0),
- combobox_2(0),
- snap_to_checkbox(0)
-{
-
-}
-
-// Destructor
-EditorPanel::~EditorPanel()
-{
-}
-
-// Wait to run this until after the panel has been added to the gui_manager
-// This sets up the buttons, text fields, etc. for this panel
-// No need to delete the buttons because the gui_manager will do it for us.
-void
-EditorPanel::init()
-{
- // Create panel buttons
- add((PanelButton*)(new PanelButtonExit(this)));
- add((PanelButton*)(new PanelButtonLoad(this)));
- add((PanelButton*)(new PanelButtonSave(this)));
- add((PanelButton*)(new PanelButtonGroundpiece(this)));
- add((PanelButton*)(new PanelButtonHead(this)));
- // Create Checkboxes
- snap_to_checkbox = new GUI::Checkbox(Vector3f(370, 5), "Snap To Grid:
", this);
- get_screen()->get_gui_manager()->add(snap_to_checkbox, true);
-
- // Create Comboboxes
- combobox_3 = new GUI::Combobox(Vector3f(500, 36), this);
- combobox_2 = new GUI::Combobox(Vector3f(500, 18), this);
- combobox_1 = new GUI::Combobox(Vector3f(500, 0), this);
- get_screen()->get_gui_manager()->add(combobox_3, true);
- get_screen()->get_gui_manager()->add(combobox_2, true);
- get_screen()->get_gui_manager()->add(combobox_1, true);
- combobox_3->set_enabled(false);
- combobox_2->set_enabled(false);
- combobox_1->set_enabled(false);
-}
-
-// Draw the panel
-void
-EditorPanel::draw (DrawingContext& gc)
-{
- // Draw the panel
- gc.draw_fillrect(0, 0, (float)Display::get_width(),
- 50.0f, Color(80,80,80), -50);
-}
-
-// Add the button to the vector, set it's position, and add to the gui_manager
-void
-EditorPanel::add(PanelButton* button)
-{
- // Determind where to place this buttons
- Vector3f new_pos;
-
- if (panel_buttons.empty())
- new_pos = Vector3f(0.0f, 0.0f, 0.0f);
- else
- new_pos = Vector3f(panel_buttons.back()->get_pos() +
- Vector3f((float)(5 +
panel_buttons.back()->get_width()), 0.0f));
- // Add button to collection of buttons
- panel_buttons.push_back(button);
-
- // Add a 5 pixel spacing between all buttons
- button->set_pos(new_pos);
-
- // Add the button to the GUI Manager
- get_screen()->get_gui_manager()->add((GUI::Component*)button, true);
-}
-
-void
-EditorPanel::set_selected_button(PanelButton* pb)
-{
- if (pressed_button)
- {
- combobox_1->set_enabled(false);
- combobox_2->set_enabled(false);
- combobox_3->set_enabled(false);
- pressed_button->select(false);
- }
-
- pressed_button = pb;
- if (pressed_button)
- pressed_button->select(true);
-}
-
-GUI::Combobox*
-EditorPanel::get_combobox(int i)
-{
- switch(i)
- {
- case 1 :
- return combobox_1;
- case 2 :
- return combobox_2;
- case 3:
- return combobox_3;
- default :
- return 0;
- }
-}
-
-void
-EditorPanel::checkbox_changed(bool new_value, GUI::Checkbox* box)
-{
- if (box == snap_to_checkbox)
- editor->get_viewport()->set_snap_to(new_value);
-}
-
-void
-EditorPanel::combobox_changed(GUI::Combobox* box)
-{
- if (pressed_button)
- {
- int i;
- if (box == combobox_1)
- i = 1;
- else if (box == combobox_2)
- i = 2;
- else
- i = 3;
-
- // Send the ID field of the Combobox to whichever button is
currently selected.
- pressed_button->combobox_changed(i,
- get_combobox(i)->get_selected_item()->get_id());
- }
-
-}
-
-} // Editor namespace
Copied: branches/pingus_sdl/src/editor/editor_panel.hpp (from rev 2685,
branches/pingus_sdl/src/editor/editor_panel.hxx)
Deleted: branches/pingus_sdl/src/editor/editor_panel.hxx
===================================================================
--- branches/pingus_sdl/src/editor/editor_panel.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/editor_panel.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,107 +0,0 @@
-// $Id: editor_panel.hxx,v 1.00 2005/11/07 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_EDITOR_PANEL_HXX
-#define HEADER_PINGUS_EDITOR_PANEL_HXX
-
-#include <vector>
-#include <iostream>
-#include "../gui/component.hxx"
-#include "../gui/checkbox_listener.hxx"
-#include "../gui/combobox_listener.hxx"
-
-
- class DrawingContext;
- class GUI::Checkbox;
- class GUI::Combobox;
-
-namespace Editor {
-
- class PanelButton;
- class EditorScreen;
-
-/** This class contains all of the buttons, comboboxes, and other components */
-class EditorPanel : public GUI::Component,
- public GUI::CheckboxListener, public GUI::ComboboxListener
-{
-private:
- /** The EditorScreen to which this panel belongs */
- EditorScreen* editor;
-
- /** Collection of buttons on this panel */
- std::vector<PanelButton*> panel_buttons;
-
- /** Currently selected object on this panel */
- PanelButton* pressed_button;
-
- /** Combobox which can change it's item list based on the button
pressed */
- GUI::Combobox* combobox_1;
- GUI::Combobox* combobox_2;
- GUI::Combobox* combobox_3;
-
- /** Checkbox which controls the snap-to-grid functionality */
- GUI::Checkbox* snap_to_checkbox;
-
-public:
- /** Constructor
- @param es The EditorScreen to which this panel belongs */
- EditorPanel(EditorScreen* es);
-
- /** Destructor - nothing really happens here */
- ~EditorPanel();
-
- /** Initialize the panel - Adds all of the buttons and text fields
- Wait to run this until after the panel has been added
to the gui_manager */
- void init();
-
- /** Add a button to the panel
- @param button The PanelButton that you'd like to add. The given
object will be
- deleted automaticly at the end. */
- void add(PanelButton* button);
-
- /** Draws the panel */
- void draw(DrawingContext& gc);
-
- /** Return the editor screen */
- EditorScreen* get_screen() { return editor; }
-
- /** Return the combobox object */
- GUI::Combobox* get_combobox(int i);
-
- /** Changes which button is currently pressed */
- void set_selected_button(PanelButton* pb);
-
- /** Event that fires when a checkbox gets changed */
- void checkbox_changed(bool new_value, GUI::Checkbox* box);
-
- /** Event that fires when a combobox gets changed */
- void combobox_changed(GUI::Combobox* box);
-
-
-private:
- EditorPanel();
- EditorPanel (const EditorPanel&);
- EditorPanel& operator= (const EditorPanel&);
-
-}; // EditorPanel
-} // Editor namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/editor_screen.cpp (from rev 2685,
branches/pingus_sdl/src/editor/editor_screen.cxx)
Deleted: branches/pingus_sdl/src/editor/editor_screen.cxx
===================================================================
--- branches/pingus_sdl/src/editor/editor_screen.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/editor_screen.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,191 +0,0 @@
-// $Id: editor_screen.cxx,v 1.00 2005/11/07 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../gui/display.hxx"
-#include "../system.hxx"
-#include "../sound/sound.hxx"
-#include "../gui/gui_manager.hxx"
-#include "../gui/screen_manager.hxx"
-#include "../display/drawing_context.hxx"
-#include "../res_descriptor.hxx"
-#include "../resource.hxx"
-#include "../fonts.hxx"
-#include "../file_dialog.hxx"
-#include "../path_manager.hxx"
-#include "editor_screen.hxx"
-#include "editor_panel.hxx"
-#include "editor_viewport.hxx"
-#include "xml_level.hxx"
-#include "level_objs.hxx"
-
-
-namespace Editor {
-
-// Default constructor
-EditorScreen::EditorScreen(XMLLevel* level)
-: plf(level),
- panel(0),
- viewport(0),
- filedialog(0),
- close_dialog(false)
-{
- if (!plf) plf = new XMLLevel();
-}
-
-// Destructor
-EditorScreen::~EditorScreen()
-{
- delete plf;
- if (filedialog)
- delete filedialog;
-}
-
-// Startup code
-void
-EditorScreen::on_startup()
-{
- // Create the viewport for the images and data
- viewport = new EditorViewport(this);
- gui_manager->add(viewport, true);
-
- // Create the panel for the buttons
- panel = new EditorPanel(this);
- gui_manager->add(panel, true);
- panel->init();
-
-}
-
-// Close the current screen
-void
-EditorScreen::close_screen()
-{
- ScreenManager::instance()->pop_screen();
-}
-
-// Escape was pressed
-void
-EditorScreen::on_escape_press()
-{
- close_screen();
-}
-
-// Show dialog box
-void
-EditorScreen::show_file_dialog(bool for_loading)
-{
- if (filedialog)
- delete filedialog;
- close_dialog = false;
- filedialog = new FileDialog(this, ".pingus",
- path_manager.complete("levels/"), for_loading);
- filedialog->preload();
-}
-
-// Close dialog box
-void
-EditorScreen::cancel()
-{
- close_dialog = true;
-}
-
-// Save the current level
-void
-EditorScreen::save(const std::string &file, const std::string &filemask)
-{
- close_dialog = true;
- plf->save_level(file);
- panel->set_selected_button(0);
-}
-
-// Load a new level
-void
-EditorScreen::load(const std::string &file, const std::string &filemask)
-{
- close_dialog = true;
- plf->load_level(file);
- viewport->refresh();
- panel->set_selected_button(0);
-}
-
-// Play the current level (save to a temporary file
-// then load it normally)
-void
-EditorScreen::play_level()
-{
- // Ask, "Would you like to save first?".
- // if so, save the file normally.
-
- // Then save to a temporary file
-
- // Load the temporary file
-}
-
-// Draw the background and components
-bool
-EditorScreen::draw(DrawingContext &gc)
-{
- // Black out screen
- gc.draw_fillrect(0, 0, (float)Display::get_width(),
- (float)Display::get_height(), Color(0,0,0), -10000);
- gui_manager->draw(gc);
-
- // FIXME: Remove this warning
- gc.print_center(Fonts::pingus_large, (float)(Display::get_width() / 2),
- (float)(Display::get_height() / 2), "Not yet functional");
-
- if (filedialog)
- filedialog->draw(gc);
-
- return true;
-}
-
-void
-EditorScreen::update(const GameDelta &delta)
-{
- if (filedialog)
- {
- if (close_dialog)
- {
- delete filedialog;
- filedialog = 0;
- }
- else
- filedialog->update(delta);
- }
- else
- GUIScreen::update(delta);
-}
-
-void
-EditorScreen::add_object(LevelObj* obj)
-{
- plf->add_object(obj);
- viewport->add_object(obj);
-}
-
-void
-EditorScreen::add_objects(std::vector<LevelObj*> objs)
-{
- for (std::vector<LevelObj*>::const_iterator it = objs.begin(); it !=
objs.end(); it++)
- add_object(*it);
-}
-
-} // Editor namespace
-
Copied: branches/pingus_sdl/src/editor/editor_screen.hpp (from rev 2685,
branches/pingus_sdl/src/editor/editor_screen.hxx)
Deleted: branches/pingus_sdl/src/editor/editor_screen.hxx
===================================================================
--- branches/pingus_sdl/src/editor/editor_screen.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/editor_screen.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,116 +0,0 @@
-// $Id: editor_screen.hxx,v 1.00 2005/11/07 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_EDITOR_SCREEN_HXX
-#define HEADER_PINGUS_EDITOR_SCREEN_HXX
-
-#include "../gui/gui_screen.hxx"
-#include "../file_dialog_listener.hxx"
-
-
-class DrawingContext;
-class FileDialog;
-class GUI::GUIManager;
-
-namespace Editor {
-
-class XMLLevel;
-class LevelObj;
-class EditorPanel;
-class EditorViewport;
-
-/** This class is the screen that contains all of the
- editor objects */
-class EditorScreen : public GUIScreen, public FileDialogListener
-{
-private:
- /** The level currently being edited */
- XMLLevel* plf;
-
- /** Panel which contains all of the buttons for each action */
- EditorPanel* panel;
-
- /** Viewport which holds all of the level images and data */
- EditorViewport* viewport;
-
- /** File Dialog box */
- FileDialog* filedialog;
-
- bool close_dialog;
-
-public:
- /** Default constructor */
- EditorScreen(XMLLevel* level = 0);
-
- /** Destructor */
- ~EditorScreen();
-
- /** Code that runs when the screen first opens */
- void on_startup();
-
- /** Closes the current screen */
- void close_screen();
-
- /** Code that runs when the Escape button is pressed */
- void on_escape_press();
-
- /** Draw the items in the screen */
- bool draw (DrawingContext& gc);
-
- /** Update the GUI objects */
- void update (const GameDelta& delta);
-
- /** Return the gui_manager */
- GUI::GUIManager* get_gui_manager() const { return gui_manager; }
-
- /** Return the viewport */
- EditorViewport* get_viewport() const { return viewport; }
-
- /** Return a pointer to the current level */
- XMLLevel* get_level() const { return plf; }
-
- /** Add an object to both the XMLLevel and the EditorViewport */
- void add_object(LevelObj* obj);
- void add_objects(std::vector<LevelObj*> objs);
-
- /** Show a file dialog box */
- void show_file_dialog(bool for_loading);
-
- /** Closes the file dialog box */
- void cancel();
-
- /** Saves the currently loaded level */
- void save(const std::string &file, const std::string &filemask);
-
- /** Load a new level */
- void load(const std::string &file, const std::string &filemask);
-
- /** Plays the currently loaded level */
- void play_level();
-
-private:
- EditorScreen (const EditorScreen&);
- EditorScreen& operator= (const EditorScreen&);
-
-}; // EditorScreen
-} // Editor namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/editor_viewport.cpp (from rev 2685,
branches/pingus_sdl/src/editor/editor_viewport.cxx)
Deleted: branches/pingus_sdl/src/editor/editor_viewport.cxx
===================================================================
--- branches/pingus_sdl/src/editor/editor_viewport.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/editor_viewport.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,283 +0,0 @@
-// $Id: editor_viewport.cxx,v 1.00 2005/11/09 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <vector>
-#include <string>
-#include <iostream>
-#include "../gui/gui_manager.hxx"
-#include "../gui/display.hxx"
-#include "../display/drawing_context.hxx"
-#include "../math/vector3f.hpp"
-#include "../graphic_context_state.hxx"
-#include "editor_viewport.hxx"
-#include "editor_screen.hxx"
-#include "context_menu.hxx"
-#include "xml_level.hxx"
-#include "level_objs.hxx"
-
-namespace Editor {
-
-// Constructor
-EditorViewport::EditorViewport(EditorScreen* e) :
- state(Display::get_width(), Display::get_height()),
- scene_context(new SceneContext()),
- editor(e),
- autoscroll(true),
- highlighted_area(0,0,0,0),
- context_menu(0),
- snap_to(false),
- current_action(NOTHING)
-{
- // FIXME: Hardcoded values should be determined by level size
- state.set_limit(Rect(-30, -50, 1600, 1300));
- state.set_pos(Vector2f(0, 0));
-}
-
-// Destructor
-EditorViewport::~EditorViewport ()
-{
-}
-
-// When someone right-clicks inside the viewport
-void
-EditorViewport::on_secondary_button_click(int x, int y)
-{
- remove_context_menu();
-
- Vector3f mouse_pos(x - (state.get_width()/2 - state.get_pos().x),
- y - (state.get_height()/2 - state.get_pos().y));
-
- std::cout << "Right-click at " << mouse_pos.x << ", "
- << mouse_pos.y << std::endl;
-
-// LevelObj* obj = object_at((int)mouse_pos.x, (int)mouse_pos.y);
- if (!current_objs.empty())
- {
- // std::vector<LevelObj*> objs;
- // objs.push_back(obj);
- context_menu = new ContextMenu(current_objs, Vector3f((float)x,
(float)y), this);
- editor->get_gui_manager()->add(context_menu, true);
- }
-}
-
-// Select 1 or more LevelObjs, or drag them.
-void
-EditorViewport::on_primary_button_press(int x, int y)
-{
- remove_context_menu();
-
- if (current_action == NOTHING)
- {
- LevelObj* obj = object_at(x - (state.get_width()/2 -
(int)state.get_pos().x),
- y - (state.get_height()/2 - (int)state.get_pos().y));
-
- if (obj)
- {
- // If the currently selected object isn't selected,
select it and deselect the rest
- if (!obj->is_selected())
- {
- for (unsigned i = 0; i < current_objs.size();
i++)
- current_objs[i]->unselect();
- current_objs.clear();
- obj->select();
- current_objs.push_back(obj);
- }
- // Allow dragging of the currently selected objects
- current_action = DRAGGING;
- drag_start_pos = mouse_at_world;
- }
- else
- {
- current_objs.clear();
- current_action = HIGHLIGHTING;
- highlighted_area.left = highlighted_area.right = x;
- highlighted_area.top = highlighted_area.bottom = y;
- }
- }
-}
-
-
-void
-EditorViewport::on_primary_button_release(int x, int y)
-{
- if (current_action == HIGHLIGHTING)
- {
- // Make sure CL_Rect starts at the top left
- if (highlighted_area.right < highlighted_area.left)
- std::swap(highlighted_area.left,
highlighted_area.right);
- if (highlighted_area.bottom < highlighted_area.top)
- std::swap(highlighted_area.top,
highlighted_area.bottom);
-
- for (unsigned i = 0; i < objs.size(); i++)
- {
- // Calculate the object's position
- Vector2i obj_pos((int)objs[i]->get_pos().x +
(state.get_width()/2 -
- (int)state.get_pos().x),
(int)objs[i]->get_pos().y + (state.get_height()/2 -
- (int)state.get_pos().y));
-
- if (highlighted_area.is_inside(obj_pos))
- {
- current_objs.push_back(objs[i]);
- objs[i]->select();
- }
- else
- objs[i]->unselect();
- }
- }
- else if (current_action == DRAGGING)
- {
- // Set the objects' positions for good
- for (unsigned i = 0; i < objs.size(); i++)
- objs[i]->set_orig_pos(objs[i]->get_pos());
- }
- current_action = NOTHING;
-}
-
-void
-EditorViewport::on_pointer_move(int x, int y)
-{
- mouse_at = Vector3f(float(x), float(y));
- mouse_at_world = Vector3f(x - (state.get_width()/2 - state.get_pos().x),
- y - (state.get_height()/2 - state.get_pos().y));
-
- if (current_action == HIGHLIGHTING)
- {
- highlighted_area.right = x;
- highlighted_area.bottom = y;
- }
- else if (current_action == DRAGGING)
- {
- float new_x, new_y;
-
- for (unsigned i = 0; i < current_objs.size(); i++)
- {
- Vector3f orig_pos(current_objs[i]->get_orig_pos());
- float x_offset = mouse_at_world.x - drag_start_pos.x;
- float y_offset = mouse_at_world.y - drag_start_pos.y;
- if (snap_to)
- {
- // FIXME: May need to adjust the snap-to offset
here.
- new_x = (float)((int)((x_offset + orig_pos.x) /
10) * 10);
- new_y = (float)((int)((y_offset + orig_pos.y) /
10) * 10);
- }
- else
- {
- new_x = x_offset + orig_pos.x;
- new_y = y_offset + orig_pos.y;
- }
- current_objs[i]->set_pos(Vector3f(new_x, new_y,
orig_pos.z));
- }
- }
-}
-
-
-// Draws all of the objects in the viewport and the background (if any)
-void
-EditorViewport::draw(DrawingContext &gc)
-{
- scene_context->clear();
- state.push(*scene_context);
-
- // Now, draw all of the objects
-
- // Draw the level objects
- for (unsigned i = 0; i < objs.size(); i++)
- objs[i]->draw(scene_context->color());
-
- if (current_action == HIGHLIGHTING)
- gc.draw_rect((float)highlighted_area.left,
(float)highlighted_area.top,
- (float)highlighted_area.right,
(float)highlighted_area.bottom,
- Color(255,255,255,150));
-
- state.pop(*scene_context);
- gc.draw(new SceneContextDrawingRequest(scene_context, Vector3f(0, 0,
-5000)));
-}
-
-// Returns true if the viewport is at the x,y coordinate
-bool
-EditorViewport::is_at(int x, int y)
-{
- // FIXME: Should return true everywhere except for on the panel
- return true;
-}
-
-void
-EditorViewport::update(float delta)
-{
- UNUSED_ARG(delta);
-
- // Autoscroll if necessary
- if (autoscroll)
- {
- const int autoscroll_border = 10;
- if (autoscroll)
- {
- if (mouse_at.x < autoscroll_border)
- state.set_pos(state.get_pos() - Vector2f(5, 0));
- else if ((float)Display::get_width() - mouse_at.x <
autoscroll_border)
- state.set_pos(state.get_pos() + Vector2f(5, 0));
- else if (mouse_at.y < autoscroll_border)
- state.set_pos(state.get_pos() - Vector2f(0, 5));
- else if ((float)Display::get_height() - mouse_at.y <
autoscroll_border)
- state.set_pos(state.get_pos() + Vector2f(0, 5));
- }
- }
-}
-
-LevelObj*
-EditorViewport::object_at (int x, int y)
-{
- // we travel reversly through the object list, so that we get the
- // top-most object
- for (std::vector<LevelObj*>::reverse_iterator i = objs.rbegin ();
- i != objs.rend (); ++i)
- {
- if ((*i)->is_at (x, y))
- return *i;
- }
- return 0;
-}
-
-// Delete the context menu if it exists.
-void
-EditorViewport::remove_context_menu()
-{
- if (context_menu)
- {
- editor->get_gui_manager()->remove(context_menu);
- context_menu->display(false);
- context_menu = 0;
- }
-}
-
-void
-EditorViewport::refresh()
-{
- objs = editor->get_level()->get_objects();
-}
-
-void
-EditorViewport::add_object(LevelObj* obj)
-{
- objs.push_back(obj);
-}
-
-} // Editor namespace
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/editor_viewport.hpp (from rev 2685,
branches/pingus_sdl/src/editor/editor_viewport.hxx)
Deleted: branches/pingus_sdl/src/editor/editor_viewport.hxx
===================================================================
--- branches/pingus_sdl/src/editor/editor_viewport.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/editor_viewport.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,134 +0,0 @@
-// $Id: editor_viewport.hxx,v 1.00 2005/11/09 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_EDITOR_VIEWPORT_HXX
-#define HEADER_PINGUS_EDITOR_VIEWPORT_HXX
-
-#include "../gui/component.hxx"
-#include "../graphic_context_state.hxx"
-#include <vector>
-#include <string>
-
-
- class Vector3f;
- class DrawingContext;
- class SceneContext;
-
-namespace Editor {
-
- class LevelObj;
- class EditorScreen;
- class ContextMenu;
-
-/** This class is where the actual level graphics will display in the
- level editor. Objects can be added, deleted, moved, modified, etc.
- inside of the EditorViewport */
-class EditorViewport : public GUI::Component {
-
-public:
- /** Constructor
- @param e The EditorScreen to which this viewport belongs */
- EditorViewport (EditorScreen* e);
-
- /** Destructor */
- ~EditorViewport ();
-
- /** Draws all of the objects in the viewport */
- void draw(DrawingContext &gc);
-
- /** Update information about scrolling, etc. */
- void update(float delta);
-
- /** Returns whether or not the mouse is inside the viewport */
- bool is_at(int x, int y);
-
- /** Emitted when the pointer moved, x and y are the new pointer
- coordinates */
- void on_pointer_move (int x, int y);
-
- /** Get rid of context menu if it exists */
- void remove_context_menu();
-
- /** Refresh the list of objects (do when loading or creating a new
level) */
- void refresh();
-
- /** Turns the "snap-to-grid" option on or off */
- void set_snap_to(bool s) { snap_to = s; }
-
- /** Add an object to the currently displayed vector of objects */
- void add_object(LevelObj* obj);
-
- /** Return a pointer to the EditorScreen object */
- EditorScreen* get_screen() { return editor; }
-
-private:
- EditorViewport();
- EditorViewport (const EditorViewport&);
- EditorViewport& operator= (const EditorViewport&);
-
- GraphicContextState state;
- SceneContext* scene_context;
-
- /** The EditorScreen to which this viewport belongs */
- EditorScreen* editor;
-
- /** Whether or not Autoscrolling is turned on */
- bool autoscroll;
-
- /** Where the mouse is right now - used for autoscrolling */
- Vector3f mouse_at;
-
- /** Where the mouse is at in relation to the world/level */
- Vector3f mouse_at_world;
-
- /** Where the mouse started dragging from */
- Vector3f drag_start_pos;
-
- /** All objects in the level */
- std::vector<LevelObj*> objs;
-
- /** The currently selected LevelObjs */
- std::vector<LevelObj*> current_objs;
-
- /** The region that is currently highlighted */
- Rect highlighted_area;
-
- /** Returns the topmost object at this x, y location */
- LevelObj* object_at(int x, int y);
-
- /** There should only be 0 or 1 context menus on the screen */
- ContextMenu* context_menu;
-
- /** Whether or not the "snap-to-grid" functionality is on. */
- bool snap_to;
-
- /** What is the currently selected action that the mouse is doing */
- enum ActionType { NOTHING = 0, HIGHLIGHTING = 1, DRAGGING = 2 }
current_action;
-
- /// Mouse actions
- void on_primary_button_press(int x, int y);
- void on_primary_button_release(int x, int y);
- void on_secondary_button_click(int x, int y);
-};
-
-} // Editor namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/level_head.cpp (from rev 2685,
branches/pingus_sdl/src/editor/level_head.cxx)
Deleted: branches/pingus_sdl/src/editor/level_head.cxx
===================================================================
--- branches/pingus_sdl/src/editor/level_head.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/level_head.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,137 +0,0 @@
-// $Id: level_head.hxx,v 1.00 2006/02/05 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/drawing_context.hxx"
-#include "../gui/gui_manager.hxx"
-#include "../gui/surface_button.hxx"
-#include "../gui/input_box.hxx"
-#include "../sound/sound.hxx"
-#include "../resource.hxx"
-#include "../math/vector3f.hpp"
-#include "../fonts.hxx"
-#include "../gettext.h"
-#include "level_head.hxx"
-#include "level_impl.hxx"
-#include "../gui/display.hxx"
-#include "panel_buttons.hxx"
-#include "editor_panel.hxx"
-#include "editor_screen.hxx"
-#include "xml_level.hxx"
-
-namespace Editor {
-
- class LevelHeadCloseButton : public GUI::SurfaceButton
- {
- private:
- LevelHead* head;
- std::string label;
-
- public:
- LevelHeadCloseButton(LevelHead* h)
- : GUI::SurfaceButton(Display::get_width() -200,
- Display::get_height() -100,
- ResDescriptor("core/menu/exit_button_normal"),
- ResDescriptor("core/menu/exit_button_pressed"),
- ResDescriptor("core/menu/exit_button_hover")),
- head(h),
- label(_("Ok"))
- {
- }
-
- void draw (DrawingContext& gc) {
- SurfaceButton::draw(gc);
- gc.print_right(Fonts::chalk_large, (float)Display::get_width() - 150,
- (float)Display::get_height() - 100, label);
- }
-
- void on_click()
- {
- head->get_head_button()->remove_head();
- }
-
- void on_pointer_enter()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
- }
- };
-
-LevelHead::LevelHead(EditorPanel* p, PanelButtonHead* pbh) :
- head_button(pbh),
- impl(p->get_screen()->get_level()->get_level_impl()),
- gui_manager(p->get_screen()->get_gui_manager()),
- pos(Vector3f(50, 75))
-{
- gui_manager->add((GUI::Component*)this, false);
-
- // Create GUI items
- name = new GUI::InputBox(400, Vector3f(pos.x + 175, pos.y + 10),
- impl->levelname, false, "Level Name");
- desc = new GUI::InputBox(500, Vector3f(pos.x + 175, pos.y + 60),
- impl->description, false, "Level Description");
-
- // Add GUI Items to the GUIManager
- gui_manager->add((GUI::Component*)name, true);
- gui_manager->add((GUI::Component*)desc, true);
-
- // Add close button
- close_button = new LevelHeadCloseButton(this);
- gui_manager->add((GUI::Component*)close_button, true);
-}
-
-LevelHead::~LevelHead()
-{
- // Remove all GUI Items from the GUIManager
- gui_manager->remove(name);
- gui_manager->remove(desc);
- gui_manager->remove(close_button);
- gui_manager->remove((GUI::Component*)this);
-}
-
-void
-LevelHead::draw(DrawingContext& gc)
-{
- // Draw the background for window
- gc.draw_fillrect(pos.x, pos.y, (float)Display::get_width() - 50,
- (float)Display::get_height()-50, Color(100,150,50,150));
- // Draw the window border
- gc.draw_rect(pos.x, pos.y, (float)Display::get_width() - 50,
- (float)Display::get_height()-50, Color(255,255,255));
-}
-
-bool
-LevelHead::is_at(int x, int y)
-{
- return (x > pos.x && y > pos.y && x < Display::get_width()-50 &&
- y < Display::get_height()-50);
-}
-
-void
-LevelHead::update(float delta)
-{
- UNUSED_ARG(delta);
- // FIXME: Should only update this information if it has changed.
- impl->levelname = name->get_string();
- impl->description = desc->get_string();
-}
-
-
-} // Editor
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/level_head.hpp (from rev 2685,
branches/pingus_sdl/src/editor/level_head.hxx)
Deleted: branches/pingus_sdl/src/editor/level_head.hxx
===================================================================
--- branches/pingus_sdl/src/editor/level_head.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/level_head.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,78 +0,0 @@
-// $Id: level_head.hxx,v 1.00 2006/02/05 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_EDITOR_LEVEL_HEAD_HXX
-#define HEADER_PINGUS_EDITOR_LEVEL_HEAD_HXX
-
-#include "../gui/component.hxx"
-
-
- class Vector3f;
-
-namespace GUI {
- class GUIManager;
- class InputBox;
-}
-
-namespace Editor {
-
- class LevelImpl;
- class PanelButtonHead;
- class EditorPanel;
- class LevelHeadCloseButton;
-
- /** This class draws a box with different input boxes that
- * determine the specific level information which is saved
- * in the <HEAD> section of the XML level file */
-class LevelHead : public GUI::Component
-{
-private:
- /** The level we are editing */
- PanelButtonHead* head_button;
-
- LevelImpl *impl;
-
- GUI::GUIManager* gui_manager;
-
- /** Where this box is drawn*/
- Vector3f pos;
-
- // Input boxes for each item of the level impl
- GUI::InputBox* name;
- GUI::InputBox* desc;
- LevelHeadCloseButton* close_button;
-
-public:
-
- LevelHead(EditorPanel* p, PanelButtonHead* pbh);
- ~LevelHead();
-
- PanelButtonHead* get_head_button() { return head_button; }
-
- // GUI Component stuff
- bool is_at(int x, int y);
- void draw(DrawingContext& gc);
- void update(float delta);
-};
-
-} // Editor namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/level_impl.hpp (from rev 2685,
branches/pingus_sdl/src/editor/level_impl.hxx)
Deleted: branches/pingus_sdl/src/editor/level_impl.hxx
===================================================================
--- branches/pingus_sdl/src/editor/level_impl.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/level_impl.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,94 +0,0 @@
-// $Id: level_impl.hxx,v 1.00 2005/11/11 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_EDITOR_LEVEL_IMPL_HXX
-#define HEADER_PINGUS_EDITOR_LEVEL_IMPL_HXX
-
-#include <map>
-#include <string>
-#include <vector>
-#include <algorithm>
-#include "level_objs.hxx"
-
-
-namespace Editor {
-
- static bool LevelObjSort(LevelObj *a, LevelObj *b)
- {
- return (a->get_pos().z < b->get_pos().z);
- }
-
-class LevelImpl
-{
-public:
- // Set defaults in constructor
- LevelImpl()
- : ambient_light(255, 255, 255),
- music("none")
- {
- // Do nothing
- }
-
- /** Destructor */
- ~LevelImpl()
- {
- for (unsigned i = 0; i < objects.size(); i++)
- delete objects[i];
- objects.clear();
- }
-
- std::string resname;
-
- std::string levelname;
- std::string description;
-
- Color ambient_light;
- Size size;
-
- int number_of_pingus;
- int number_to_save;
-
- std::map<std::string, int> actions;
-
- int time;
- int difficulty;
-
- std::string author;
- std::string comment;
- std::string music;
-
- std::vector<LevelObj*> objects;
-
- /** Sort the objects by their z position */
- void sort_objs()
- {
- std::stable_sort(objects.begin(), objects.end(), LevelObjSort);
- }
-
-private:
- LevelImpl (const LevelImpl&);
- LevelImpl& operator= (const LevelImpl&);
-}; // LevelImpl class
-
-} // Editor namespace
-
-#endif
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/editor/level_objs.cpp (from rev 2685,
branches/pingus_sdl/src/editor/level_objs.cxx)
Deleted: branches/pingus_sdl/src/editor/level_objs.cxx
===================================================================
--- branches/pingus_sdl/src/editor/level_objs.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/level_objs.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,323 +0,0 @@
-// $Id: level_objs.cxx,v 1.00 2005/11/15 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <string>
-#include <iostream>
-#include "level_objs.hxx"
-#include "level_impl.hxx"
-#include "../blitter.hxx"
-#include "../resource.hxx"
-#include "../res_descriptor.hxx"
-#include "../gui/display.hxx"
-#include "../display/drawing_context.hxx"
-#include "../xml_file_writer.hxx"
-
-
-namespace Editor {
-
-// Default constructor
-LevelObj::LevelObj(std::string obj_name, LevelImpl* level_) :
- level(level_),
- pos(Vector3f(0,0,0)),
- translated_pos(Vector3f(0,0,0)),
- section_name(obj_name),
- speed(0),
- parallax(0.0),
- width(0),
- owner_id(-1),
- release_rate(0),
- scroll_x(0),
- scroll_y(0),
- stretch_x(false),
- stretch_y(false),
- keep_aspect(false),
- para_x(0),
- para_y(0),
- color(0,0,0,0),
- attribs(get_attributes(obj_name)),
- removed(false),
- selected(false)
-{
- if (attribs & HAS_SURFACE_FAKE)
- load_generic_surface();
-}
-
-void
-LevelObj::set_res_desc(const ResDescriptor d)
-{
- desc = d;
- refresh_sprite();
-}
-
-// Draw the sprite
-void
-LevelObj::draw(DrawingContext &gc)
-{
- if (!removed && attribs & (HAS_SURFACE | HAS_SURFACE_FAKE))
- {
- // If selected, draw a highlighted box around it
- if (selected)
- gc.draw_rect(translated_pos.x, translated_pos.y,
translated_pos.x
- + sprite.get_width(), translated_pos.y +
sprite.get_height(),
- Color(255,255,255,150), 5000);
- if (attribs & HAS_WIDTH)
- {
- for(int x = static_cast<int>(pos.x); x < pos.x + width;
x += sprite.get_width())
- gc.draw(sprite, Vector3f(static_cast<float>(x),
pos.y, pos.z));
- }
- else if(attribs & HAS_STRETCH)
- {
- // Surface Background - tile it
- for (int x = 0; x < level->size.width; x +=
sprite.get_width())
- for (int y = 0; y < level->size.height; y +=
sprite.get_height())
- gc.draw(sprite, Vector3f((float)x,
(float)y, pos.z));
- }
- else
- gc.draw(sprite, pos);
- }
-}
-
-bool
-LevelObj::is_at(int x, int y)
-{
- if (!removed && attribs & (HAS_SURFACE | HAS_SURFACE_FAKE))
- {
- return (x > translated_pos.x && x < translated_pos.x +
sprite.get_width()
- && y > translated_pos.y && y < translated_pos.y +
sprite.get_height());
- }
- else
- return false;
-}
-
-void
-LevelObj::set_stretch_x(const bool s)
-{
- stretch_x = s;
-}
-
-void
-LevelObj::set_stretch_y(const bool s)
-{
- stretch_y = s;
-}
-
-void
-LevelObj::set_aspect(const bool a)
-{
- keep_aspect = a;
-}
-
-void
-LevelObj::refresh_sprite()
-{
- if (attribs & HAS_SURFACE)
- {
- sprite = Resource::load_sprite(desc);
- ////int x, y;
- ////sprite.get_alignment(origin, x, y);
-
- PixelBuffer pb;
-
- // Apply modifier, then change the sprite loaded for this
object in memory.
- if (stretch_x || stretch_y)
- {
- float w = (float)sprite.get_width();
- float h = (float)sprite.get_height();
-
- // Determine the new dimensions for the sprite
- if (stretch_x && !stretch_y)
- {
- if (keep_aspect)
- h = h * Display::get_width() / w;
- w = (float)Display::get_width();
- }
- else if (stretch_y && !stretch_x)
- {
- if (keep_aspect)
- w = w * Display::get_height() / h;
- h = (float)Display::get_height();
- }
- else
- {
- w = (float)Display::get_width();
- h = (float)Display::get_height();
- }
-
- //FIXME: Sat Jan 13 10:26:15 2007
- assert(0);
- // pb = Blitter::scale_surface_to_canvas(
- // sprite.get_frame_pixeldata(0), (int)w, (int)h);
-
- }
- else // No stretch involved
- pb = Resource::load_pixelbuffer(desc);
-#if 0
- SpriteDescription sprite_desc;
- sprite_desc.add_frame(pb);
- sprite = Sprite(sprite_desc);
-
- sprite.set_alignment(origin, x, y);
-#endif
- }
- set_translated_pos();
-}
-
-// Set the modifier and actually modify the sprite loaded in memory
-void
-LevelObj::set_modifier(const std::string m)
-{
- // Set modifier
- if (attribs & CAN_ROTATE)
- desc.modifier = ResourceModifierNS::rs_from_string(m);
- refresh_sprite();
-}
-
-// Writes the XML attributes for the file
-void
-LevelObj::write_properties(XMLFileWriter &xml)
-{
- if (!removed)
- {
- xml.begin_section(section_name.c_str());
-
- const unsigned attribs = get_attributes(section_name);
-
- // Write information about the main sprite
- if (attribs & HAS_SURFACE)
- {
- xml.begin_section("surface");
- xml.write_string("image", desc.res_name);
- xml.write_string("modifier",
ResourceModifierNS::rs_to_string(desc.modifier));
- xml.end_section(); // surface
- }
- // Write the optional information
- if (attribs & HAS_TYPE)
- xml.write_string("type", object_type);
- if (attribs & HAS_SPEED)
- xml.write_int("speed", speed);
- if (attribs & HAS_PARALLAX)
- xml.write_float("parallax", parallax);
- if (attribs & HAS_WIDTH)
- xml.write_int("width", width);
- if (attribs & HAS_OWNER)
- xml.write_int("owner-id", owner_id);
- if (attribs & HAS_DIRECTION)
- xml.write_string("direction", direction);
- if (attribs & HAS_RELEASE_RATE)
- xml.write_int("release-rate", release_rate);
- if (attribs & HAS_COLOR)
- ////xml.write_color("color", color);
- if (attribs & HAS_STRETCH)
- {
- xml.write_bool("stretch-x", stretch_x);
- xml.write_bool("stretch-y", stretch_y);
- xml.write_bool("keep-aspect", keep_aspect);
- }
- if (attribs & HAS_SCROLL)
- {
- xml.write_float("scroll-x", scroll_x);
- xml.write_float("scroll-y", scroll_y);
- }
- if (attribs & HAS_PARA)
- {
- xml.write_float("para-x", para_x);
- xml.write_float("para-y", para_y);
- }
-
- // Writes any extra properties that may be necessary (virtual
function)
- write_extra_properties(xml);
-
- // Write the Vector3f position - all objects have this
- ////xml.write_vector("position", pos);
-
- xml.end_section(); // object's section_name
- }
-}
-
-void
-LevelObj::load_generic_surface()
-{
- if (section_name == "entrance")
- {
- desc.res_name = "entrances/generic";
- desc.modifier = ResourceModifierNS::ROT0;
- sprite = Resource::load_sprite(desc);
- }
-}
-
-// The translated pos is where the object appears to be "at" instead
-// of using it's "translation origin" specified in the sprite resource files
-void
-LevelObj::set_translated_pos()
-{
- if (!sprite)
- return;
-
- translated_pos = pos;
-
- Origin orig = origin_top_left;
- ////int x, y;
- float w = (float)sprite.get_width();
- float h = (float)sprite.get_height();
-
- ////sprite.get_alignment(orig, x, y);
- switch (orig)
- {
- case origin_top_left :
- break;
- case origin_top_center :
- translated_pos.x -= w / 2;
- break;
- case origin_top_right :
- translated_pos.x -= w;
- break;
- case origin_center_left :
- translated_pos.y -= w / 2;
- break;
- case origin_center :
- translated_pos.x -= w / 2;
- translated_pos.y -= h / 2;
- break;
- case origin_center_right :
- translated_pos.x -= w;
- translated_pos.y -= h / 2;
- break;
- case origin_bottom_left :
- translated_pos.y -= h;
- break;
- case origin_bottom_center :
- translated_pos.x -= w / 2;
- translated_pos.y -= h;
- break;
- case origin_bottom_right :
- translated_pos.x -= w;
- translated_pos.y -= h;
- }
-}
-
-void
-LevelObj::set_pos(Vector3f p)
-{
- pos = p;
- set_translated_pos();
-}
-
-} // Editor namespace
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/level_objs.hpp (from rev 2685,
branches/pingus_sdl/src/editor/level_objs.hxx)
Deleted: branches/pingus_sdl/src/editor/level_objs.hxx
===================================================================
--- branches/pingus_sdl/src/editor/level_objs.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/level_objs.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,337 +0,0 @@
-// $Id: level_objs.hxx,v 1.00 2005/11/15 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_EDITOR_LEVEL_OBJS_HXX
-#define HEADER_PINGUS_EDITOR_LEVEL_OBJS_HXX
-
-#include "../sprite.hpp"
-#include "../math/color.hpp"
-#include "../math/origin.hpp"
-#include "../math/vector3f.hpp"
-#include "../res_descriptor.hxx"
-#include <string>
-
-
- class XMLFileWriter;
- class DrawingContext;
-
-namespace Editor {
-
- const unsigned HAS_TYPE = 1;
- const unsigned HAS_SPEED = 2;
- const unsigned HAS_PARALLAX = 4;
- const unsigned HAS_WIDTH = 8;
- const unsigned HAS_OWNER = 16;
- const unsigned HAS_COLOR = 32;
- const unsigned HAS_SCROLL = 64;
- const unsigned HAS_PARA = 128;
- const unsigned HAS_STRETCH = 256;
- const unsigned HAS_DIRECTION = 512;
- const unsigned HAS_RELEASE_RATE = 1024;
- const unsigned HAS_SURFACE = 2048;
- // HAS_SURFACE_FAKE means it has a generic image in the editor, but
isn't saved.
- const unsigned HAS_SURFACE_FAKE = 4096;
- const unsigned CAN_ROTATE = 8192;
-
- /** Returns a number representing which attributes this object
possesses */
- inline unsigned int get_attributes(std::string obj_type)
- {
- unsigned val;
- if (obj_type == "groundpiece")
- val = HAS_TYPE | HAS_SURFACE | CAN_ROTATE;
- else if (obj_type == "hotspot")
- val = HAS_SPEED | HAS_PARALLAX | HAS_SURFACE |
CAN_ROTATE;
- else if (obj_type == "liquid")
- val = HAS_SPEED | HAS_WIDTH | HAS_SURFACE;
- else if (obj_type == "surface-background")
- val = HAS_COLOR | HAS_STRETCH | HAS_PARA | HAS_SCROLL |
HAS_SURFACE;
- else if (obj_type == "entrance" || obj_type == "woodthing")
- val = HAS_TYPE | HAS_DIRECTION | HAS_RELEASE_RATE |
HAS_OWNER | HAS_SURFACE_FAKE;
- else if (obj_type == "exit")
- val = HAS_OWNER | HAS_SURFACE;
- else
- val = 0;
-
- return val;
- }
-
- class LevelImpl;
-
-/** Generic Level Object (groundpiece, sign, etc.) Only special objects will
have
- to inherit from this class - most objects will be able to use
this class alone */
- class LevelObj
-{
-protected:
- /** Sprite used to draw this object */
- Sprite sprite;
-
- /** Level to which this object belongs */
- LevelImpl* level;
-
- /** Resource Desciptor of this object */
- ResDescriptor desc;
-
- /** Location of this object in the World */
- Vector3f pos;
-
- /** Only used for display functions - this is the pos Vector3f adjusted
- by the translation origin of the sprite */
- Vector3f translated_pos;
-
- /** Location of this object before moving it around */
- Vector3f orig_pos;
-
- /** Name of the section header for this object (hotspot, groundpiece,
etc.) */
- std::string section_name;
-
- /** Optional type field for certain objects */
- std::string object_type;
-
- /** Optional speed field for certain objects */
- int speed;
-
- /** Optional parallax field for certain objects */
- float parallax;
-
- /** Optional width field for certain objects */
- int width;
-
- /** Optional owner id field for certain objects */
- int owner_id;
-
- /** Optional release rate field for certain objects (entrances) */
- int release_rate;
-
- /** Optional direction field for certain objects */
- std::string direction;
-
- /** Optional scroll field in the x direction for certain objects */
- float scroll_x;
-
- /** Optional scroll field in the y direction for certain objects */
- float scroll_y;
-
- /** Optional stretch field in the x direction for certain objects */
- bool stretch_x;
-
- /** Optional stretch field in the y direction for certain objects */
- bool stretch_y;
-
- /** Optional field for keeping the aspect ratio of stretched objects */
- bool keep_aspect;
-
- /** Optional parallax field in the x direction for certain objects */
- float para_x;
-
- /** Optional parallax field in the y direction for certain objects */
- float para_y;
-
- /** Optional color field for certain objects */
- Color color;
-
- /** Optional translation origin of the sprite */
- Origin origin;
-
- /** Number representing which attributes this object possesses */
- unsigned attribs;
-
- /** Marks if this object has been deleted or not */
- bool removed;
-
- /** Marks is this object is currently selected */
- bool selected;
-
- /** Loads any generic images necessary for objects with
HAS_FAKE_SURFACE */
- void load_generic_surface();
-
- /** Write any additional properties to the XML file for this type */
- virtual void write_extra_properties(XMLFileWriter& xml) { }
-
- /** Sets a position vector of where the sprite is located based
- on the "translation origin" specified in the sprite file. */
- void set_translated_pos();
-
-
-/////////////////////////////////////////////////////////
-/// Retrieve info
-public:
- /** Retrieve the object's position */
- Vector3f get_pos() const { return pos; }
- Vector3f get_orig_pos() const { return orig_pos; }
-
- /** Retrieve this object's attribute number */
- unsigned get_attribs() const { return attribs; }
-
- /** Retrieve the object's resource name */
- ResDescriptor get_res_desc() const { return desc; }
-
- /** Retrieve the name of the section header for this object */
- std::string get_section_name() const { return section_name; }
-
- /** Retrieve the object's type */
- std::string get_type() const { return object_type; }
-
- /** Retrieve the object's speed */
- int get_speed() const { return speed; }
-
- /** Retrieve the object's release rate (entrances) */
- int get_release_rate() const { return release_rate; }
-
- /** Retrive the object's parallax (is this even used???) */
- float get_parallax() const { return parallax; }
-
- /** Retrieve the object's owner */
- int get_owner() const { return owner_id; }
-
- /** Retrieve the object's width */
- int get_width() const { return width; }
-
- /** Retrieve the object's color */
- Color get_color() const { return color; }
-
- /** Returns true if the object is stretched in the x direction */
- bool get_stretch_x() const { return stretch_x; }
-
- /** Returns true if the object is stretched in the y direction */
- bool get_stretch_y() const { return stretch_y; }
-
- /** Returns true if the object is to maintain it's aspect ratio if
stretched */
- bool get_aspect() const { return keep_aspect; }
-
- /** Retrive the objects scroll value in the x direction */
- float get_scroll_x() const { return scroll_x; }
-
- /** Retrive the objects scroll value in the y direction */
- float get_scroll_y() const { return scroll_y; }
-
- /** Returns the parallax speed multiplier in the x direction */
- float get_para_x() const { return para_x; }
-
- /** Returns the parallax speed multiplier in the y direction */
- float get_para_y() const { return para_y; }
-
- bool is_selected() { return selected; }
-
- /** Retrieve the object's direction */
- std::string get_direction() { return direction; }
-
-
-/////////////////////////////////////////////////////////
-/// Operations
-public:
- /** Set the object's position */
- void set_pos(const Vector3f p);
-
- /** Original position of the objects before being dragged around */
- void set_orig_pos(const Vector3f p) { orig_pos = p; }
-
- /** Set the object's resource name */
- void set_res_desc(const ResDescriptor d);
-
- /** Set the object's modifier */
- void set_modifier(const std::string m);
-
- /** Set the object's section header name */
- void set_section_name(const std::string sn) { section_name = sn; }
-
- /** Set the object's type */
- void set_type(const std::string t) { object_type = t; }
-
- /** Set the object's speed */
- void set_speed(const int s) { speed = s; }
-
- /** Set the objects release rate */
- void set_release_rate(const int r) { release_rate = r; }
-
- /** Set the object's parallax */
- void set_parallax(const float para) { parallax = para; }
-
- /** Set the object's width */
- void set_width(const int w) { width = w; }
-
- /** Set the object's owner_id */
- void set_owner(const int id) { owner_id = id; }
-
- /** Set the object's scroll rate in the x direction */
- void set_scroll_x(const float s) { scroll_x = s; }
-
- /** Set the object's scroll rate in the y direction */
- void set_scroll_y(const float s) { scroll_y = s; }
-
- /** Set the objects stretch in the x direction value */
- void set_stretch_x(const bool s);
-
- /** Set the objects stretch in the y direction value */
- void set_stretch_y(bool s);
-
- /** Set whether or not the object should maintain it's aspect ratio
when stretched */
- void set_aspect(const bool a);
-
- /** Set the objects color if applicable */
- void set_color(const Color& c)
- { color = c; }
-
- /** Set the object's parallax scroll multiplier in the x direction */
- void set_para_x(const float p) { para_x = p; }
-
- /** Set the object's parallax scroll multiplier in the y direction */
- void set_para_y(const float p) { para_y = p; }
-
- /** Set the object's direction if applicable */
- void set_direction(const std::string d) { direction = d; }
-
- /** Soft delete of the object (needed for Undo action) */
- void remove() { removed = true; }
-
- /** Undelete this object if it's been removed */
- void unremove() { removed = false; }
-
- /** Select or unselect this object */
- void select() { selected = true; }
- void unselect() { selected = false; }
-
- /** Write basic properties to the XML file for this type */
- virtual void write_properties(XMLFileWriter &xml);
-
- /** Call when the sprite needs to be reloaded */
- void refresh_sprite();
-
- /** Draws the sprite with the modifier applied */
- virtual void draw(DrawingContext &gc);
-
- /** Returns true if the mouse is hovering over this object */
- virtual bool is_at (int x, int y);
-
- /** Default Constructor */
- LevelObj(const std::string obj_name, LevelImpl* level_);
-
- /** Destructor */
- virtual ~LevelObj() { }
-
-private:
- LevelObj (const LevelObj&);
- LevelObj& operator= (const LevelObj&);
-
-}; // LevelObj class
-
-} // Editor namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/panel_buttons.cpp (from rev 2685,
branches/pingus_sdl/src/editor/panel_buttons.cxx)
Deleted: branches/pingus_sdl/src/editor/panel_buttons.cxx
===================================================================
--- branches/pingus_sdl/src/editor/panel_buttons.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/panel_buttons.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,251 +0,0 @@
-// $Id: editor_panel.cxx,v 1.00 2005/11/07 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <vector>
-#include "../gui/combobox.hxx"
-#include "../gui/gui_manager.hxx"
-#include "../display/scene_context.hxx"
-#include "../path_manager.hxx"
-#include "../fonts.hxx"
-#include "../resource.hxx"
-#include "panel_buttons.hxx"
-#include "editor_screen.hxx"
-#include "editor_panel.hxx"
-#include "level_objs.hxx"
-#include "level_head.hxx"
-#include "xml_level.hxx"
-
-
-class Resource;
-
-namespace Editor {
-
-// Constructor
-PanelButton::PanelButton(EditorPanel* p) :
- hover(false),
- panel(p),
- is_selected(false)
-{
- button = Resource::load_sprite("core/editor/button");
- button_pressed = Resource::load_sprite("core/editor/button_pressed");
-}
-
-// Draw the button
-void
-PanelButton::draw(DrawingContext &gc)
-{
- if (is_selected)
- gc.draw(button_pressed, pos);
- else
- gc.draw(button, pos);
-
- // Print the tooltip
- if (hover)
- gc.print_left(Fonts::pingus_small, pos.x, pos.y +
(float)get_width(),
- tooltip, 50);
-
- // Draw the actual button image
- gc.draw(sur, pos);
-}
-
-// Set the position of this panelbutton
-void
-PanelButton::set_pos(Vector3f p)
-{
- pos = p;
-}
-
-// Is this button at these x,y coordinates?
-bool
-PanelButton::is_at(int x, int y)
-{
- return (x > pos.x && x < pos.x + sur.get_width()
- && y > pos.y && y < pos.y + sur.get_height());
-}
-
-// Something all buttons should do.
-void
-PanelButton::on_primary_button_click(int x, int y)
-{
- UNUSED_ARG(x);
- UNUSED_ARG(y);
- panel->set_selected_button(this);
-}
-
-// Standard exit button
-PanelButtonExit::PanelButtonExit(EditorPanel *p) :
- PanelButton(p)
-{
- tooltip = "Exit the editor";
- sur = Resource::load_sprite("core/editor/exit");
-}
-
-// When clicked, close the EditorScreen
-void
-PanelButtonExit::on_primary_button_click(int x, int y)
-{
- PanelButton::on_primary_button_click(x, y);
- panel->get_screen()->on_escape_press();
-}
-
-// Standard Load button
-PanelButtonLoad::PanelButtonLoad(EditorPanel *p) :
- PanelButton(p)
-{
- tooltip = "Load existing level";
- sur = Resource::load_sprite("core/editor/open");
-}
-
-// When clicked, close the EditorScreen
-void
-PanelButtonLoad::on_primary_button_click(int x, int y)
-{
- PanelButton::on_primary_button_click(x, y);
- panel->get_screen()->show_file_dialog(true);
-}
-
-// Standard save button
-PanelButtonSave::PanelButtonSave(EditorPanel *p) :
- PanelButton(p)
-{
- tooltip = "Save current level";
- sur = Resource::load_sprite("core/editor/save");
-}
-
-// When clicked, close the EditorScreen
-void
-PanelButtonSave::on_primary_button_click(int x, int y)
-{
- PanelButton::on_primary_button_click(x, y);
- panel->get_screen()->show_file_dialog(false);
-}
-
-
-// Load the groundpieces
-PanelButtonGroundpiece::PanelButtonGroundpiece(EditorPanel *p) :
- PanelButton(p)
-{
- sur = Resource::load_sprite("core/editor/save"); // FIXME: Update this
sprite
- tooltip = "Load a groundpiece";
-}
-
-void
-PanelButtonGroundpiece::on_primary_button_click(int x, int y)
-{
-#if 0
- PanelButton::on_primary_button_click(x, y);
-
- panel->get_combobox(1)->clear();
- panel->get_combobox(1)->set_label("Type");
- panel->get_combobox(2)->set_label("Subtype");
- panel->get_combobox(3)->set_label("Groundpiece");
- std::vector<std::string> groundpieces =
Resource::get_sections("groundpieces");
- for (unsigned i = 0; i < groundpieces.size(); i++)
- {
- // We add each ComboItem to the first box:
- // - The ID field of the ComboItem should be the full resource
name.
- // - The displayed field should only be the section name.
- panel->get_combobox(1)->add(new GUI::ComboItem("groundpieces/"
+ groundpieces[i],
- groundpieces[i]));
- }
- panel->get_combobox(1)->set_enabled(true);
-#endif
-}
-
-// Populate the other comboboxes with the available resources.
-void
-PanelButtonGroundpiece::combobox_changed(int i, const std::string &value)
-{
-#if 0
- std::string section;
- if (i == 1)
- {
- // Populate the 2nd combobox with the next resource section &
disable box 3.
- panel->get_combobox(2)->clear();
- panel->get_combobox(2)->set_enabled(true);
- panel->get_combobox(3)->set_enabled(false);
-
- std::vector<std::string> groundpieces = Resource::get_sections(
-
panel->get_combobox(1)->get_selected_item()->get_displayed_string());
- for (std::vector<std::string>::const_iterator it =
groundpieces.begin();
- it != groundpieces.end(); it++)
- panel->get_combobox(2)->add(new GUI::ComboItem(value +
"/" + (*it), (*it)));
- }
- else if (i == 2)
- {
- // Populate the 3rd combobox with the Resource ID's
- panel->get_combobox(3)->clear();
- panel->get_combobox(3)->set_enabled(true);
-
- std::vector<std::string> groundpieces = Resource::get_resources(
- "sprite", value);
- for (std::vector<std::string>::const_iterator it =
groundpieces.begin();
- it != groundpieces.end(); it++)
- {
- // new_value is the "displayed_string" for the combobox.
- std::string new_value = (*it).substr(value.length()+1);
- panel->get_combobox(3)->add(new GUI::ComboItem(value +
"/" + new_value,
- new_value));
- }
- }
- else
- {
- // 3rd box was selected - add the resource to the current level.
- LevelObj* obj = new LevelObj("groundpiece",
panel->get_screen()->get_level()->get_level_impl());
- obj->set_res_desc(ResDescriptor(value));
- obj->set_pos(Vector3f(0, 0, 0));
- // 1st combobox displayed the "type" of resource (solid,
transparent, etc.)
-
obj->set_type(panel->get_combobox(1)->get_selected_item()->get_displayed_string());
- panel->get_screen()->add_object(obj);
- }
-#endif
-}
-
-PanelButtonHead::PanelButtonHead(EditorPanel *p)
- : PanelButton(p),
- head(0)
-{
- // FIXME: Update this sprite
- sur = Resource::load_sprite("core/editor/save");
- tooltip = "Set specific level information";
-}
-
-void
-PanelButtonHead::on_primary_button_click(int x, int y)
-{
- PanelButton::on_primary_button_click(x, y);
- if (!head)
- {
- head = new LevelHead(panel, this);
- }
- else
- {
- remove_head();
- }
-}
-
-void
-PanelButtonHead::remove_head()
-{
- delete head;
- head = 0;
-}
-
-
-} // Editor namespace
Copied: branches/pingus_sdl/src/editor/panel_buttons.hpp (from rev 2685,
branches/pingus_sdl/src/editor/panel_buttons.hxx)
Deleted: branches/pingus_sdl/src/editor/panel_buttons.hxx
===================================================================
--- branches/pingus_sdl/src/editor/panel_buttons.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/panel_buttons.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,212 +0,0 @@
-// $Id: editor_panel.hxx,v 1.00 2005/11/07 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PANEL_BUTTONS_HXX
-#define HEADER_PINGUS_PANEL_BUTTONS_HXX
-
-#include "../gui/component.hxx"
-#include "../math/vector3f.hpp"
-
-class DrawingContext;
-
-namespace Editor {
-
-class EditorPanel;
-class LevelHead;
-
-/** Generic PanelButton class - all buttons in the Editor should inherit from
this */
-class PanelButton : public GUI::Component
-{
-private:
- /** Whether or not the mouse is over the button */
- bool hover;
-
-protected:
- /** The actual button image */
- Sprite sur;
-
- /** The button background image when not pressed */
- Sprite button;
-
- /** The button background image while pressed */
- Sprite button_pressed;
-
- /** The panel to which this button belongs */
- EditorPanel* panel;
-
- /** The string that appears when the mouse is hovering over this button
*/
- std::string tooltip;
-
- /** The location of this button on the screen (set by the EditorPanel)
*/
- Vector3f pos;
-
- /** Is this button currently selected? */
- bool is_selected;
-
-public:
- /** Constructor
- @param p The EditorPanel to which this button belongs */
- PanelButton(EditorPanel* p);
-
- /** Destructor - nothing really happens here */
- virtual ~PanelButton() { }
-
- /** Set the position of this button on the screen - used by the
EditorPanel
- @param p the x,y,z Vector3f where this button belongs */
- void set_pos (Vector3f p);
-
- /** Returns the Vector3f of this button's location */
- Vector3f get_pos () { return pos; }
-
- /** Returns the width of the sur sprite */
- int get_width() { return sur.get_width(); }
-
- /** Returns the height of the sur sprite */
- int get_height() { return sur.get_height(); }
-
- /** Draws the button */
- void draw(DrawingContext& gc);
-
- /** Return true if the button is located at this x,y coordinate */
- bool is_at(int x, int y);
-
- /** Action taken when the button is clicked */
- virtual void on_primary_button_click(int x, int y);
-
- /** Action taken when the mouse enters the button area */
- virtual void on_pointer_enter () { hover = true; }
-
- /** Action taken when the mouse leaves the button area */
- virtual void on_pointer_leave () { hover = false; }
-
- /** Action taken when the button is selected or not */
- virtual void select(bool s) { is_selected = s; }
-
- /** Event that fires when the first combobox has been changed */
- virtual void combobox_changed(int i, const std::string &value) { }
-
-private:
- PanelButton (const PanelButton&);
- PanelButton& operator= (const PanelButton&);
-}; // PanelButton class
-
-
-/** Standard exit button */
-class PanelButtonExit : public PanelButton
-{
-public:
- /** Constructor
- @param p the EditorPanel to which this button belongs */
- PanelButtonExit (EditorPanel* p);
-
- /** This function is called by the gui_manager when the button is
clicked */
- void on_primary_button_click (int x, int y);
-
-private:
- PanelButtonExit ();
- PanelButtonExit (const PanelButtonExit&);
- PanelButtonExit& operator= (const PanelButtonExit&);
-}; // PanelButtonExit class
-
-
-/** Standard load button */
-class PanelButtonLoad : public PanelButton
-{
-public:
- /** Constructor
- @param p the EditorPanel to which this button belongs */
- PanelButtonLoad (EditorPanel* p);
-
- /** This function is called by the gui_manager when the button is
clicked */
- void on_primary_button_click (int x, int y);
-
-private:
- PanelButtonLoad ();
- PanelButtonLoad (const PanelButtonLoad&);
- PanelButtonLoad& operator= (const PanelButtonLoad&);
-}; // PanelButtonLoad class
-
-
-/** Standard save button */
-class PanelButtonSave : public PanelButton
-{
-public:
- /** Constructor
- @param p the EditorPanel to which this button belongs */
- PanelButtonSave (EditorPanel* p);
-
- /** This function is called by the gui_manager when the button is
clicked */
- void on_primary_button_click (int x, int y);
-
-private:
- PanelButtonSave ();
- PanelButtonSave (const PanelButtonSave&);
- PanelButtonSave& operator= (const PanelButtonSave&);
-}; // PanelButtonSave class
-
-
-/** Display all of the groundpiece objects */
-class PanelButtonGroundpiece : public PanelButton
-{
-public:
- /** Constructor
- @param p the EditorPanel to which this button belongs */
- PanelButtonGroundpiece (EditorPanel* p);
-
- /** This function is called by the gui_manager when the button is
clicked */
- virtual void on_primary_button_click (int x, int y);
-
- /** Want to update the other comboboxes with the new groundpieces */
- virtual void combobox_changed(int i, const std::string &value);
-
-private:
- PanelButtonGroundpiece ();
- PanelButtonGroundpiece (const PanelButtonGroundpiece&);
- PanelButtonGroundpiece& operator= (const PanelButtonGroundpiece&);
-}; // PanelButtonGroundpiece class
-
-
-/** Display all of the level description <HEAD> information */
-class PanelButtonHead : public PanelButton
-{
- private:
- LevelHead* head;
-
- public:
- /** Constructor
- @param p the EditorPanel to which this button belongs */
- PanelButtonHead (EditorPanel* p);
-
- /** This function is called by the gui_manager when the button is clicked
*/
- virtual void on_primary_button_click (int x, int y);
-
- void remove_head();
-
- private:
- PanelButtonHead ();
- PanelButtonHead (const PanelButtonHead&);
- PanelButtonHead& operator= (const PanelButtonHead&);
-}; // PanelButtonHead class
-
-} // Editor namespace
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/editor/xml_level.cpp (from rev 2685,
branches/pingus_sdl/src/editor/xml_level.cxx)
Deleted: branches/pingus_sdl/src/editor/xml_level.cxx
===================================================================
--- branches/pingus_sdl/src/editor/xml_level.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/xml_level.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,257 +0,0 @@
-// $Id: xml_level.cxx,v 1.00 2005/11/11 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <string>
-#include <fstream>
-#include "xml_level.hxx"
-#include "level_impl.hxx"
-#include "level_objs.hxx"
-#include "../xml_pingus_level.hxx"
-#include "../xml_file_writer.hxx"
-#include "../xml_file_reader.hxx"
-#include "../res_descriptor.hxx"
-
-
-namespace Editor {
-
-// Default constructor
-XMLLevel::XMLLevel() :
- impl(new LevelImpl())
-{
-
-}
-
-// Default Destructor
-XMLLevel::~XMLLevel()
-{
- if (impl)
- delete impl;
-}
-
-/** Verify that level is valid:
- Level should contain the following attributes in order to be "valid":
- -----------
- LevelObj's:
- - At least 1 entrance
- - At least 1 exit
- - At least 1 surface-background
- - Each object should be within valid ranges (pos Vector3f should be inside
the world)
- -----------
- Head section:
- - Everything should be filled in and within valid ranges
- */
-bool XMLLevel::is_valid()
-{
- std::cout << "XMLLevel::is_valid() - Not yet implemented" << std::endl;
- if (impl)
- return true;
- else
- return false;
-}
-
-// Save the level to a file. Returns true if successful
-bool XMLLevel::save_level(const std::string& filename)
-{
-#if 0
- // Make sure level is valid
- if (!is_valid())
- return false;
-
- // Create new XML file (overwrite existing file)
- std::ofstream out_file(filename.c_str());
- XMLFileWriter xml(out_file);
-
- // Write header
- xml.begin_section("pingus-level");
- xml.write_int("version", 2);
- xml.begin_section("head");
- xml.write_string("levelname", impl->levelname);
- xml.write_string("description", impl->description);
- xml.write_string("author", impl->author);
- xml.write_int("number-of-pingus", impl->number_of_pingus);
- xml.write_int("number-to-save", impl->number_to_save);
- xml.write_int("time", impl->time);
- xml.write_int("difficulty", impl->difficulty);
- // FIXME: Allow user to decide if level is playable or not
- xml.write_int("playable", 1);
- xml.write_string("comment", impl->comment);
- xml.write_string("music", impl->music);
-
- // Write the list of actions to the file
- xml.begin_section("actions");
- for (std::map<std::string, int>::const_iterator i =
impl->actions.begin();
- i != impl->actions.end(); i++)
- {
- xml.write_int(i->first.c_str(), i->second);
- }
- xml.end_section(); // actions
-
- xml.begin_section("levelsize");
- xml.write_int("width", impl->size.width);
- xml.write_int("height", impl->size.height);
- xml.end_section(); // levelsize
- xml.end_section(); // head
-
- // Write the objects
- xml.begin_section("objects");
- for (unsigned i = 0; i < impl->objects.size(); i++)
- impl->objects[i]->write_properties(xml);
- xml.end_section(); // objects
-
- xml.end_section(); // pingus-level
-
- // Clean up
- out_file.close();
-#endif
- return true;
-}
-
-// Load an existing level from a file
-void XMLLevel::load_level(const std::string& filename)
-{
-#if 0
- if (impl)
- delete impl;
- impl = new LevelImpl();
-
- // Load the level from the file - we don't care what it's res_name is.
- XMLPingusLevel existing_level("", filename);
-
- // Assign all of the level information to our LevelImpl
- impl->levelname = existing_level.get_levelname();
- impl->description = existing_level.get_description();
- impl->ambient_light = existing_level.get_ambient_light();
- impl->size = existing_level.get_size();
- impl->number_of_pingus = existing_level.get_number_of_pingus();
- impl->number_to_save = existing_level.get_number_to_save();
- impl->actions = existing_level.get_actions();
- impl->time = existing_level.get_time();
- impl->difficulty = existing_level.get_difficulty();
- impl->author = existing_level.get_author();
- impl->music = existing_level.get_music();
-
- // Temporary objects
- unsigned attribs;
- Vector3f p;
- Colorf tmp_color;
- ResDescriptor desc;
- std::string tmp_str;
- int tmp_int;
- float tmp_float;
- bool tmp_bool;
-
- // Get the objects
- std::vector<FileReader> objs = existing_level.get_objects();
- for (std::vector<FileReader>::const_iterator i = objs.begin(); i !=
objs.end(); i++)
- {
- // Create new object
- LevelObj* obj = new LevelObj(i->get_name(), impl);
- attribs = obj->get_attribs();
-
- // All objects have a position - get that.
- i->read_vector("position", p);
- obj->set_orig_pos(p);
- obj->set_pos(p);
-
- // Get optional attributes based on the attribs value
- if (attribs & HAS_SURFACE)
- {
- i->read_desc("surface", desc);
- obj->set_res_desc(desc);
- }
- if (attribs & HAS_TYPE)
- {
- i->read_string("type", tmp_str);
- obj->set_type(tmp_str);
- }
- if (attribs & HAS_SPEED)
- {
- i->read_int("speed", tmp_int);
- obj->set_speed(tmp_int);
- }
- if (attribs & HAS_WIDTH)
- {
- i->read_int("width", tmp_int);
- obj->set_width(tmp_int);
- }
- if (attribs & HAS_PARALLAX)
- {
- i->read_float("parallax", tmp_float);
- obj->set_parallax(tmp_float);
- }
- if (attribs & HAS_OWNER)
- {
- i->read_int("owner-id", tmp_int);
- obj->set_owner(tmp_int);
- }
- if (attribs & HAS_DIRECTION)
- {
- i->read_string("direction", tmp_str);
- obj->set_direction(tmp_str);
- }
- if (attribs & HAS_COLOR)
- {
- i->read_color("color", tmp_color);
- obj->set_color(tmp_color);
- }
- if (attribs & HAS_SCROLL)
- {
- i->read_float("scroll-x", tmp_float);
- obj->set_scroll_x(tmp_float);
- i->read_float("scroll-y", tmp_float);
- obj->set_scroll_y(tmp_float);
- }
- if (attribs & HAS_STRETCH)
- {
- i->read_bool("stretch-x", tmp_bool);
- obj->set_stretch_x(tmp_bool);
- i->read_bool("stretch-y", tmp_bool);
- obj->set_stretch_y(tmp_bool);
- i->read_bool("keep-aspect", tmp_bool);
- obj->set_aspect(tmp_bool);
- }
- if (attribs & HAS_PARA)
- {
- i->read_float("para-x", tmp_float);
- obj->set_para_x(tmp_float);
- i->read_float("para-y", tmp_float);
- obj->set_para_y(tmp_float);
- }
- if (attribs & HAS_RELEASE_RATE)
- {
- i->read_int("release-rate", tmp_int);
- obj->set_release_rate(tmp_int);
- }
-
- impl->objects.push_back((LevelObj*)obj);
- }
-
- // Sort by Z coordinate
- impl->sort_objs();
-#endif
-}
-
-void
-XMLLevel::add_object(LevelObj* obj)
-{
- impl->objects.push_back(obj);
-}
-
-} // Editor namespace
Copied: branches/pingus_sdl/src/editor/xml_level.hpp (from rev 2685,
branches/pingus_sdl/src/editor/xml_level.hxx)
Deleted: branches/pingus_sdl/src/editor/xml_level.hxx
===================================================================
--- branches/pingus_sdl/src/editor/xml_level.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/editor/xml_level.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,72 +0,0 @@
-// $Id: xml_level.hxx,v 1.00 2005/11/11 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_EDITOR_XMLLEVEL_HXX
-#define HEADER_PINGUS_EDITOR_XMLLEVEL_HXX
-
-#include <vector>
-#include "level_impl.hxx"
-
-
-namespace Editor {
-
- class LevelObj;
-
-class XMLLevel
-{
-private:
- LevelImpl* impl;
-
-public:
-
- /** Construct new blank level */
- XMLLevel();
-
- /** Destructor */
- ~XMLLevel();
-
- /** Verify that level is valid */
- bool is_valid();
-
- /** Save the level to a file. Returns true if successful */
- bool save_level(const std::string& filename);
-
- /** Load an existing level from a file */
- void load_level(const std::string& filename);
-
- /** Return all objects in the level */
- std::vector<LevelObj*> get_objects() const { return impl->objects; }
-
- /** Add an object to the level */
- void add_object(LevelObj* obj);
-
- /** Return LevelImpl */
- LevelImpl* get_level_impl() { return impl; }
-
-
-private:
- XMLLevel (const XMLLevel&);
- XMLLevel& operator= (const XMLLevel&);
-}; // XMLLevel class
-
-} // Editor namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/exit_menu.cpp (from rev 2685,
branches/pingus_sdl/src/exit_menu.cxx)
Deleted: branches/pingus_sdl/src/exit_menu.cxx
===================================================================
--- branches/pingus_sdl/src/exit_menu.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/exit_menu.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,124 +0,0 @@
-// $Id: exit_menu.cxx,v 1.24 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "gettext.h"
-#include "pingus_menu_manager.hxx"
-#include "resource.hxx"
-#include "gui/surface_button.hxx"
-#include "gui/gui_manager.hxx"
-#include "sound/sound.hxx"
-
-
-class ExitMenuYesButton : public GUI::SurfaceButton
-{
-private:
- PingusMenuManager* manager;
-public:
- ExitMenuYesButton (PingusMenuManager* m)
- : GUI::SurfaceButton(Display::get_width()/2 - 170,
- Display::get_height()/2 + 15,
- ResDescriptor("core/menu/exit_button_normal"),
- ResDescriptor("core/menu/exit_button_pressed"),
- ResDescriptor("core/menu/exit_button_hover")),
- manager (m)
- {
- }
-
- void draw (DrawingContext& gc) {
- SurfaceButton::draw(gc);
- gc.print_right(Fonts::chalk_large, (float)Display::get_width()/2 - 80,
- (float)Display::get_height()/2 + 25, _("Yes"));
- }
-
- void on_click()
- {
- Sound::PingusSound::play_sound ("yipee");
- manager->exit ();
- }
-
- void on_pointer_enter()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
- }
-};
-
-class ExitMenuNoButton : public GUI::SurfaceButton
-{
-private:
- PingusMenuManager* manager;
-public:
- ExitMenuNoButton (PingusMenuManager* m)
- : GUI::SurfaceButton(Display::get_width()/2, Display::get_height()/2 + 15,
- ResDescriptor("core/menu/exit_button_normal"),
- ResDescriptor("core/menu/exit_button_pressed"),
- ResDescriptor("core/menu/exit_button_hover")),
- manager(m)
- {
- }
-
- void draw (DrawingContext& gc) {
- SurfaceButton::draw(gc);
- gc.print_right(Fonts::chalk_large, (float)Display::get_width()/2 + 80,
- (float)Display::get_height()/2 + 25, _("No"));
- }
-
- void on_click() {
- Sound::PingusSound::play_sound ("yipee");
- manager->pop_menu();
- }
-
- void on_pointer_enter()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
- }
-};
-
-ExitMenu::ExitMenu (PingusMenuManager* manager_)
- : PingusSubMenu (manager_)
-{
- gui_manager->add(new ExitMenuYesButton(manager), true);
- gui_manager->add(new ExitMenuNoButton (manager), true);
-}
-
-ExitMenu::~ExitMenu ()
-{
-}
-
-bool
-ExitMenu::draw(DrawingContext& gc)
-{
- //gc.draw_fillrect (0, 0, Display::get_width (), Display::get_height (),
- //0, 0, 0, 0.5);
- gc.draw(sur, Vector3f(gc.get_width ()/2 - sur.get_width ()/2,
- gc.get_height ()/2 - sur.get_height ()/2));
- gc.print_center(Fonts::chalk_large, gc.get_width()/2, gc.get_height()/2 -
70, _("Exit Pingus?"));
- PingusSubMenu::draw(gc);
- return true;
-}
-
-void
-ExitMenu::preload ()
-{
- sur = Resource::load_sprite("core/menu/exit_menu");
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/exit_menu.hpp (from rev 2685,
branches/pingus_sdl/src/exit_menu.hxx)
Deleted: branches/pingus_sdl/src/exit_menu.hxx
===================================================================
--- branches/pingus_sdl/src/exit_menu.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/exit_menu.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,48 +0,0 @@
-// $Id: exit_menu.hxx,v 1.14 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_EXIT_MENU_HXX
-#define HEADER_PINGUS_EXIT_MENU_HXX
-
-#include "pingus_sub_menu.hxx"
-
-
-class PingusMenuManager;
-
-class ExitMenu : public PingusSubMenu
-{
-private:
- Sprite sur;
-
-public:
- ExitMenu (PingusMenuManager* manager);
- ~ExitMenu ();
-
- bool draw (DrawingContext& gc);
- void preload ();
-
-private:
- ExitMenu (const ExitMenu&);
- ExitMenu& operator= (const ExitMenu&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/file_dialog.cpp (from rev 2685,
branches/pingus_sdl/src/file_dialog.cxx)
Deleted: branches/pingus_sdl/src/file_dialog.cxx
===================================================================
--- branches/pingus_sdl/src/file_dialog.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/file_dialog.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,457 +0,0 @@
-// $Id: file_dialog.cxx,v 1.00 2005/11/18 00:30:04 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "gettext.h"
-#include "system.hxx"
-#include "pingus_menu_manager.hxx"
-#include "resource.hxx"
-#include "gui/surface_button.hxx"
-#include "gui/gui_manager.hxx"
-#include "gui/input_box.hxx"
-#include "sound/sound.hxx"
-#include "file_dialog.hxx"
-#include "file_dialog_item.hxx"
-#include "file_dialog_listener.hxx"
-
-
- const int DIR_UP = 0;
- const int DIR_DOWN = 1;
-
- class FileDialogOkButton : public GUI::SurfaceButton
- {
- private:
- FileDialog* file_dialog;
- std::string label;
- bool is_hidden;
-
- public:
- FileDialogOkButton (FileDialog *f, std::string l)
- : GUI::SurfaceButton(Display::get_width()/2 + 170,
- Display::get_height()/2 + 160,
- ResDescriptor("core/menu/exit_button_normal"),
- ResDescriptor("core/menu/exit_button_pressed"),
- ResDescriptor("core/menu/exit_button_hover")),
- file_dialog(f),
- label (l),
- is_hidden(true)
- {
- }
-
- void draw (DrawingContext& gc) {
- if (!is_hidden)
- {
- SurfaceButton::draw(gc);
- gc.print_right(Fonts::chalk_large,
(float)Display::get_width()/2 + 200,
- (float)Display::get_height()/2 + 160,
label);
- }
- }
-
- void on_click()
- {
- if (!is_hidden)
- {
- Sound::PingusSound::play_sound ("yipee");
- file_dialog->ok_pressed();
- }
- }
-
- void on_pointer_enter()
- {
- if (!is_hidden)
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
- }
- }
-
- void hide() { is_hidden = true; }
- void show() { is_hidden = false; }
-
- };
-
- class FileDialogCancelButton : public GUI::SurfaceButton
- {
- private:
- FileDialog* file_dialog;
-
- public:
- FileDialogCancelButton (FileDialog* f)
- : GUI::SurfaceButton(Display::get_width()/2 - 280,
- Display::get_height()/2 + 160,
- ResDescriptor("core/menu/exit_button_normal"),
- ResDescriptor("core/menu/exit_button_pressed"),
- ResDescriptor("core/menu/exit_button_hover")),
- file_dialog (f)
- {
- }
-
- void draw (DrawingContext& gc) {
- SurfaceButton::draw(gc);
- gc.print_right(Fonts::chalk_large,
(float)Display::get_width()/2 - 200,
- (float)Display::get_height()/2 + 160,
_("Cancel"));
- }
-
- void on_click()
- {
- Sound::PingusSound::play_sound ("yipee");
- file_dialog->cancel_pressed();
- }
-
- void on_pointer_enter()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
- }
- };
-
- class FileDialogScrollButton : public GUI::Component
- {
- private:
- /** FileDialog box to this which button is assigned */
- FileDialog* file_dialog;
-
- /** Where the image is located */
- Vector3f pos;
-
- /** Image used for the scroll button */
- Sprite sprite;
-
- /** 0 for Up, 1 for Down */
- int direction;
-
- /** Show it or not */
- bool is_hidden;
-
- bool hover;
-
- public:
- FileDialogScrollButton (FileDialog* f, int d, int height_offset)
- : file_dialog(f),
- pos(Vector3f((float)Display::get_width()/2 +
210,
- (float)Display::get_height()/2 +
height_offset)),
- direction(d),
- is_hidden(false),
- hover(false)
- {
- std::string str_direction = d==0 ? "up" : "down";
- sprite = Resource::load_sprite("core/menu/" +
str_direction + "_arrow");
- }
-
- void draw (DrawingContext& gc) {
- if (!is_hidden)
- {
- gc.draw(sprite, pos);
- if (hover)
- gc.draw_rect(pos.x, pos.y, pos.x +
sprite.get_width(),
- pos.y + sprite.get_height(),
Color(255,255,255,150));
- }
- }
-
- void on_primary_button_click(int x, int y)
- {
- file_dialog->scroll(direction);
- }
-
- void on_pointer_enter() { hover = true; }
- void on_pointer_leave() { hover = false; }
-
- bool is_at(int x, int y)
- {
- if (is_hidden)
- return false;
- return (x > (int)pos.x && x < (int)pos.x +
sprite.get_width()
- && y > (int)pos.y && y < (int)pos.y +
sprite.get_height());
- }
-
- void show() { is_hidden = false; }
- void hide() { is_hidden = true; }
- };
-
- class FileDialogParentFolderButton : public GUI::Component
- {
- private:
- /** FileDialog box to this which button is assigned */
- FileDialog* file_dialog;
-
- /** Where the image is located */
- Vector3f pos;
-
- /** Image used for the parent folder button */
- Sprite sprite;
-
- bool hover;
-
- public:
- FileDialogParentFolderButton (FileDialog* f)
- : file_dialog(f),
- pos(Vector3f((float)Display::get_width()/2 + 230,
- (float)Display::get_height()/2 - 210)),
-
sprite(Resource::load_sprite("core/menu/parent_folder")),
- hover(false)
- {
- }
-
- void draw (DrawingContext& gc) {
- gc.draw(sprite, pos);
- if (hover)
- gc.draw_rect(pos.x, pos.y, pos.x +
sprite.get_width(),
- pos.y + sprite.get_height(),
Color(255,255,255,150));
- }
-
- void on_primary_button_click(int x, int y)
- {
- FileItem f;
- f.name = "..";
- f.is_directory = true;
- file_dialog->set_selected_file(f);
- }
-
- void on_pointer_enter() { hover = true; }
- void on_pointer_leave() { hover = false; }
-
- bool is_at(int x, int y)
- {
- return (x > (int)pos.x && x < (int)pos.x +
sprite.get_width()
- && y > (int)pos.y && y < (int)pos.y +
sprite.get_height());
- }
- };
-
- FileDialog::FileDialog (FileDialogListener* listener_,
- const std::string filemask_,
- const std::string searchpath_,
- bool for_load)
- : PingusSubMenu (PingusMenuManager::instance()),
-
listener(listener_),
- for_loading(for_load),
- file_mask(filemask_),
- current_path(searchpath_)
- {
- // Initialize the buttons
- ok_button = new FileDialogOkButton(this,
- for_loading ? _("Load") : _("Save"));
-
- up_button = new FileDialogScrollButton(this, DIR_UP, -150);
- down_button = new FileDialogScrollButton(this, DIR_DOWN, 100);
-
- gui_manager->add(ok_button, true);
- gui_manager->add(up_button, true);
- gui_manager->add(down_button, true);
- gui_manager->add(new FileDialogCancelButton(this), true);
- gui_manager->add(new FileDialogParentFolderButton(this), true);
-
- // FIXME: Ugly - hardcoded values for items in file dialog.
Should be dynamic.
- // Create 8 FileDialogItems and add them to the gui_manager.
- float center_x = (float)Display::get_width()/2;
- float center_y = (float)Display::get_height()/2;
-
- inputbox = new GUI::InputBox(450, Vector3f(center_x - 225,
- center_y - 170), "", for_loading);
- gui_manager->add((GUI::Component*)inputbox, true);
-
- file_dialog_items.push_back(new FileDialogItem(this,
- Vector3f(center_x - 280, center_y - 140)));
- file_dialog_items.push_back(new FileDialogItem(this,
- Vector3f(center_x - 280, center_y - 70)));
- file_dialog_items.push_back(new FileDialogItem(this,
- Vector3f(center_x - 280, center_y + 10)));
- file_dialog_items.push_back(new FileDialogItem(this,
- Vector3f(center_x - 280, center_y + 80)));
- file_dialog_items.push_back(new FileDialogItem(this,
- Vector3f(center_x - 10, center_y - 140)));
- file_dialog_items.push_back(new FileDialogItem(this,
- Vector3f(center_x - 10, center_y - 70)));
- file_dialog_items.push_back(new FileDialogItem(this,
- Vector3f(center_x - 10, center_y + 10)));
- file_dialog_items.push_back(new FileDialogItem(this,
- Vector3f(center_x - 10, center_y + 80)));
-
- for (std::vector<FileDialogItem*>::const_iterator i =
file_dialog_items.begin();
- i != file_dialog_items.end(); i++)
- gui_manager->add((GUI::Component*)(*i), true);
-
- refresh();
- }
-
- FileDialog::~FileDialog ()
- {
- }
-
- bool
- FileDialog::draw (DrawingContext& gc)
- {
- gc.draw(sprite, Vector3f(gc.get_width ()/2 - sprite.get_width
()/2,
- gc.get_height ()/2 - sprite.get_height ()/2));
- gc.draw_rect(gc.get_width() / 2 - 285, gc.get_height() / 2 -
160,
- gc.get_width() / 2 + 285, gc.get_height() / 2 +
160, Color(0,0,0));
- gc.print_center(Fonts::chalk_large, gc.get_width()/2,
gc.get_height()/2 - 220,
- current_file.friendly_name == "" ? current_file.name :
current_file.friendly_name);
-
- PingusSubMenu::draw(gc);
- return true;
- }
-
- void
- FileDialog::preload ()
- {
- sprite = Resource::load_sprite("core/menu/filedialog");
- }
-
- void
- FileDialog::refresh ()
- {
- // Clear the current list of files
- file_list.clear();
- current_offset=0;
-
- FileItem f;
-
- // Get the list of files and folders in the current folder
-#if 0
- CL_DirectoryScanner scanner;
- scanner.scan(current_path, "*");
- while (scanner.next())
- {
- if (scanner.get_name() != "." && scanner.get_name() !=
".."
- && scanner.get_name() != ".svn" &&
scanner.is_directory())
- {
- f.name = scanner.get_name();
- f.is_directory = true;
- file_list.push_back(f);
- }
- }
-
- scanner.scan(current_path, "*" + file_mask);
- while (scanner.next())
- {
- f.name = scanner.get_name();
- f.is_directory = false;
- file_list.push_back(f);
- }
-
- std::sort(file_list.begin(), file_list.end(), &FileItemCompare);
-#endif
- current_offset = 0;
- offset_changed();
- }
-
- // Whenever the list of showing files has changed.
- void
- FileDialog::offset_changed()
- {
- unsigned j = current_offset;
-
- for (std::vector<FileDialogItem*>::const_iterator i =
file_dialog_items.begin();
- i != file_dialog_items.end(); i++, j++)
- {
- if (j < (unsigned)file_list.size())
- (*i)->set_file(file_list[j]);
- else
- (*i)->hide();
- }
-
- // Show or hide scroll buttons
- if (current_offset == 0)
- up_button->hide();
- else
- up_button->show();
-
- if (current_offset + (unsigned)file_dialog_items.size() <
(unsigned)file_list.size())
- down_button->show();
- else
- down_button->hide();
- }
-
- // Scroll the list up or down.
- void
- FileDialog::scroll(int direction)
- {
- if (direction == DIR_UP)
- {
- if (current_offset != 0)
- current_offset -=
(unsigned)file_dialog_items.size();
- }
- else
- {
- if (current_offset + (unsigned)file_dialog_items.size()
< (unsigned)file_list.size())
- current_offset +=
(unsigned)file_dialog_items.size();
- }
- offset_changed();
- }
-
- // Set the file and show or hide the OK button.
- void
- FileDialog::set_selected_file(FileItem f)
- {
- current_file = f;
- if (current_file.name != "")
- ok_button->show();
- else
- ok_button->hide();
-
- inputbox->set_string(current_file.name.substr(0,
- current_file.name.length()-file_mask.length()));
-
- if (current_file.is_directory)
- ok_pressed();
- }
-
- void
- FileDialog::ok_pressed()
- {
- // If it's a directory, change to it.
- if (current_file.is_directory)
- {
- current_path += current_file.name + "/";
- refresh();
- ok_button->hide();
- }
- else
- {
- if (for_loading)
- listener->load(current_path +
current_file.name, file_mask);
- else
- listener->save(current_path +
current_file.name, file_mask);
- }
- }
-
- void
- FileDialog::cancel_pressed()
- {
- listener->cancel();
- }
-
- void
- FileDialog::update(const GameDelta &delta)
- {
- PingusSubMenu::update(delta);
-
- // FIXME: Ugly busy polling
- if (!for_loading)
- if (inputbox->get_string() != current_file.name)
- {
- FileItem f;
- f.friendly_name = inputbox->get_string();
- f.name = f.friendly_name + file_mask;
- f.is_directory = false;
- set_selected_file(f);
- }
- }
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/file_dialog.hpp (from rev 2685,
branches/pingus_sdl/src/file_dialog.hxx)
Deleted: branches/pingus_sdl/src/file_dialog.hxx
===================================================================
--- branches/pingus_sdl/src/file_dialog.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/file_dialog.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,140 +0,0 @@
-// $Id: file_dialog.hxx,v 1.0 2005/11/18 00:30:04 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_FILE_DIALOG_HXX
-#define HEADER_PINGUS_FILE_DIALOG_HXX
-
-#include <vector>
-#include <string>
-#include "pingus_sub_menu.hxx"
-
-
-class Vector;
-class FileDialogItem;
-class FileDialogOkButton;
-class FileDialogScrollButton;
-class FileDialogListener;
-
-namespace GUI {
-class InputBox;
-}
-
-struct FileItem {
- std::string name;
- std::string short_name;
- std::string friendly_name;
- bool is_accessible;
- bool is_finished;
- bool is_directory;
-};
-
-/** Sorting function for FileItem's */
-inline bool FileItemCompare (const FileItem& a, const FileItem& b)
-{
- if (a.is_directory == b.is_directory)
- return (a.name < b.name);
- else
- return (a.is_directory);
-}
-
-class FileDialog : public PingusSubMenu
-{
-private:
- Sprite sprite;
-
- /** The OK button - need to be able to hide and show it */
- FileDialogOkButton* ok_button;
-
- /** Scroll buttons */
- FileDialogScrollButton* up_button;
- FileDialogScrollButton* down_button;
-
- /** The owner of this file dialog */
- FileDialogListener* listener;
-
- /** Box to take the keyboard input */
- GUI::InputBox* inputbox;
-
- /** Should this dialog box be used for loading? True for load, false for
saving */
- bool for_loading;
-
- /** Mask for which files to display (*.pingus, *.xml, etc.) */
- std::string file_mask;
-
- /** Current path that is being displayed */
- std::string current_path;
-
- /** Offset in the file_list that is the index of the first file/folder shown
*/
- unsigned current_offset;
-
- /** Current file that is selected */
- FileItem current_file;
-
- /** List of directories & files in the current folder */
- std::vector<FileItem> file_list;
-
- /** List of files in the directory */
- std::vector<FileDialogItem*> file_dialog_items;
-
- /** Scroll the displayed file list */
- void offset_changed();
-
-public:
- FileDialog (FileDialogListener* listener_,
- const std::string filemask_,
- const std::string searchpath_,
- const bool for_load = true);
-
- ~FileDialog ();
-
- bool draw (DrawingContext& gc);
- void update(const GameDelta &delta);
-
- void preload();
-
- /** Refresh the file list */
- void refresh();
-
- /** Return the current path in the dialog */
- std::string get_path() const { return current_path; }
-
- /** Return the file mask */
- std::string get_file_mask() const { return file_mask; }
-
- /** Sets the currently selected file name */
- void set_selected_file(FileItem f);
-
- /** The Ok button has been pressed - either Save or Load this file */
- void ok_pressed();
-
- /** The Cancel button has been pressed - close the box */
- void cancel_pressed();
-
- /** Need to scroll the list of files if possible */
- void scroll(int direction);
-
-private:
- FileDialog (const FileDialog&);
- FileDialog& operator= (const FileDialog&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/file_dialog_item.cpp (from rev 2685,
branches/pingus_sdl/src/file_dialog_item.cxx)
Deleted: branches/pingus_sdl/src/file_dialog_item.cxx
===================================================================
--- branches/pingus_sdl/src/file_dialog_item.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/file_dialog_item.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,211 +0,0 @@
-// $Id: file_dialog.hxx,v 1.0 2005/11/28 00:30:04 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "pingus_error.hxx"
-#include "file_dialog_item.hxx"
-#include "file_dialog.hxx"
-#include "math/vector3f.hpp"
-#include "fonts.hxx"
-#include "resource.hxx"
-#include "gettext.h"
-#include "stat_manager.hxx"
-#include "savegame_manager.hxx"
-#include "savegame.hxx"
-#include "worldmap/manager.hxx"
-#include "worldmap/metamap.hxx"
-
- // Only Constructor
- FileDialogItem::FileDialogItem(FileDialog* f, Vector3f p)
- : mouse_over(false),
- is_hidden(true),
- file_dialog(f),
- pos(p),
- sprite(Resource::load_sprite("core/misc/404sprite"))
- {
- }
-
- /** Set the current file assigned to this button */
- void
- FileDialogItem::set_file(FileItem f)
- {
- file_item = f;
- is_hidden = false;
- // Load sprite based on file (folder icon, level screenshot,
or generic)
- if (file_item.is_directory)
- {
- file_item.is_directory = true;
- sprite = Resource::load_sprite("core/menu/folder");
- }
- else
- {
-#if 0
- // FIXME: Load thumbnail specific to this level
- sprite =
Resource::load_sprite("core/menu/default_level");
-
- // Load information about this file if possible.
- CL_InputSourceProvider_File provider(".");
- CL_DomDocument
doc(provider.open_source(file_dialog->get_path()
- + file_item.name), true);
-
- CL_DomElement root = doc.get_document_element();
-
- if (root.get_tag_name() == "pingus-level" ||
root.get_tag_name() == "pingus-worldmap")
- {
- CL_DomNodeList lst = root.get_child_nodes();
-
- for(int i = 0; i < lst.get_length(); ++i)
- {
- CL_DomElement node =
lst.item(i).to_element();
-
- // Get information about this file
- if (node.get_tag_name() == "head")
- {
- XMLFileReader reader(node);
- if (root.get_tag_name() ==
"pingus-level")
- {
- // It's a level file
-
reader.read_string("levelname", file_item.friendly_name);
-
reader.read_string("difficulty", file_info);
- file_item.is_accessible
= true;
- file_item.friendly_name
= _(file_item.friendly_name);
- file_info =
_("Difficulty: ") + file_info;
- Savegame* sg =
SavegameManager::instance()->get(file_item.friendly_name);
- if (sg)
- {
- status =
_("Finished!");
-
file_item.is_finished = (sg->status == Savegame::FINISHED);
- }
- else
- {
- status = _("Not
finished");
-
file_item.is_finished = false;
- }
- }
- else
- {
- // It's a Worldmap
-
reader.read_string("name", file_item.friendly_name);
-
reader.read_string("short-name", file_item.short_name);
-
reader.read_string("description", file_info);
-
- // Get player's status
for this worldmap
- if
(!StatManager::instance()->get_bool(
-
file_item.short_name + "-accessible", file_item.is_accessible))
- {
- status = _("Not
Accessible");
-
file_item.is_accessible = false;
- }
- else if
(!StatManager::instance()->get_bool(
-
file_item.short_name + "-finished", file_item.is_finished))
- {
- status = _("Not
Finished");
-
file_item.is_finished = false;
- }
- else
- {
- status =
_("Finished!");
-
file_item.is_finished = true;
- }
- file_item.friendly_name
= _(file_item.friendly_name);
- file_info =
_(file_info);
-
- }
- // Have to limit the size of
the printed name
- file_item.friendly_name =
file_item.friendly_name.substr(0, 23);
- break;
- } // if XML Node == "head"
- } // for loop
- } // if XML tag_name was recognized
-#endif
- } // else it's a file, not a directory
- } //set_file()
-
- bool
- FileDialogItem::is_at(int x, int y)
- {
- if (is_hidden)
- return false;
- return (x > pos.x && x < pos.x + sprite.get_width()
- && y > pos.y && y < pos.y + sprite.get_height());
- }
-
- void
- FileDialogItem::draw (DrawingContext& gc)
- {
- if (!is_hidden)
- {
- // Draw thumbnail
- gc.draw(sprite, pos);
-
- // Draw title
- gc.print_left(Fonts::pingus_small, pos.x +
(float)sprite.get_width(),
- pos.y, get_filename());
-
- // If mouse over, draw a quick info box about the file
item
- if (mouse_over)
- {
- if (file_item.is_directory)
- gc.draw_rect(pos.x, pos.y, pos.x +
sprite.get_width(),
- pos.y + sprite.get_height(),
Color(255,255,255,150));
- else // It's a file
- {
- // Determine which color to draw the
background rectangle.
- Color color;
- if (file_item.is_accessible)
- if (file_item.is_finished)
- color =
Color(123,123,0);////Color::azure;
- else
- color = Color(123,0,222);
////Color::aqua;
- else
- color = Color(255,0,0);
- gc.draw_fillrect(pos.x+50, pos.y,
pos.x+270, pos.y+75, color);
-
- // Draw level or worldmap information.
- gc.print_left(Fonts::pingus_small,
pos.x+50, pos.y, file_item.friendly_name);
- gc.print_left(Fonts::pingus_small,
pos.x+50, pos.y+25, file_info);
- gc.print_left(Fonts::pingus_small,
pos.x+50, pos.y+50, status);
- }
- }
- }
- }
-
- void
- FileDialogItem::on_primary_button_click (int x, int y)
- {
- if (file_item.is_accessible)
- file_dialog->set_selected_file(file_item);
- }
-
- void
- FileDialogItem::hide()
- {
- file_item.name = "";
- is_hidden = true;
- }
-
- std::string
- FileDialogItem::get_filename() const
- {
- if (file_item.is_directory)
- return file_item.name;
- else
- return file_item.name.substr(0, file_item.name.size() -
file_dialog->get_file_mask().size());
- }
-
-/* EOF */
Copied: branches/pingus_sdl/src/file_dialog_item.hpp (from rev 2685,
branches/pingus_sdl/src/file_dialog_item.hxx)
Deleted: branches/pingus_sdl/src/file_dialog_item.hxx
===================================================================
--- branches/pingus_sdl/src/file_dialog_item.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/file_dialog_item.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,82 +0,0 @@
-// $Id: file_dialog.hxx,v 1.0 2005/11/28 00:30:04 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_FILE_DIALOG_ITEM_HXX
-#define HEADER_PINGUS_FILE_DIALOG_ITEM_HXX
-
-#include "gui/component.hxx"
-#include "math/vector3f.hpp"
-#include "sprite.hpp"
-#include "file_dialog.hxx"
-
-
-/** Class representing a clickable object in a File Dialog (a Directory, Level,
- or Worldmap */
-class FileDialogItem : GUI::Component
-{
-private:
- bool mouse_over;
- bool is_hidden;
-
- /** Extra info about this file - differs based on file type
(difficulty, etc.) */
- std::string file_info;
- std::string status;
-
- FileDialog* file_dialog;
- Vector3f pos;
-
- /** This file_item name will change based on the current file list */
- FileItem file_item;
-
- /** This sprite will change based on the currently displayed file */
- Sprite sprite;
-
-public:
- // Only Constructor
- FileDialogItem(FileDialog* f, Vector3f p) ;
-
- /** Set the current file assigned to this button */
- void set_file(FileItem f);
-
- /** Get the cleaned up file name (no extension) */
- std::string get_filename() const;
-
- bool is_at(int x, int y);
-
- void draw (DrawingContext& gc);
-
- void hide ();
-
- void on_primary_button_click (int x, int y);
-
- /** Emmitted when pointer enters the region of the component */
- void on_pointer_enter () { mouse_over = true; }
-
- /** Emmitted when pointer leaves the region of the component */
- void on_pointer_leave () { mouse_over = false; }
-
-private:
- FileDialogItem();
- FileDialogItem (const FileDialogItem&);
- FileDialogItem& operator= (const FileDialogItem&);
-}; // FileDialogItem class
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/file_dialog_listener.hpp (from rev 2685,
branches/pingus_sdl/src/file_dialog_listener.hxx)
Deleted: branches/pingus_sdl/src/file_dialog_listener.hxx
===================================================================
--- branches/pingus_sdl/src/file_dialog_listener.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/file_dialog_listener.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,36 +0,0 @@
-// $Id: credits.hxx,v 1.16 2005/12/8 19:28:54 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_FILE_DIALOG_LISTENER_HXX
-#define HEADER_PINGUS_FILE_DIALOG_LISTENER_HXX
-
-#include <string>
-#include "pingus.hxx"
-
-class FileDialogListener {
-public:
- virtual ~FileDialogListener() {}
- virtual void save(const std::string &file, const std::string &filemask) { }
- virtual void load(const std::string &file, const std::string &filemask) { }
- virtual void cancel() { }
-}; // class FileDialogListener
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/file_reader.cpp (from rev 2685,
branches/pingus_sdl/src/file_reader.cxx)
Deleted: branches/pingus_sdl/src/file_reader.cxx
===================================================================
--- branches/pingus_sdl/src/file_reader.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/file_reader.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,176 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "sexpr_file_reader.hpp"
-#include "lisp/parser.hpp"
-#include "lisp/lisp.hpp"
-#include "file_reader.hxx"
-#include "file_reader_impl.hxx"
-
-FileReader::FileReader(SharedPtr<FileReaderImpl> impl_)
- : impl(impl_)
-{
-}
-
-FileReader::FileReader()
- : impl(0)
-{
-}
-
-std::string
-FileReader::get_name() const
-{
- if (impl.get())
- return impl->get_name();
- else
- return "";
-}
-
-bool
-FileReader::read_int(const char* name, int& value) const
-{
- if (impl.get())
- return impl->read_int(name, value);
- else
- return false;
-}
-
-bool
-FileReader::read_float (const char* name, float& value) const
-{
- if (impl.get())
- return impl->read_float(name, value);
- else
- return false;
-}
-
-bool
-FileReader::read_bool (const char* name, bool& value) const
-{
- if (impl.get())
- return impl->read_bool(name, value);
- else
- return false;
-}
-
-bool
-FileReader::read_string(const char* name, std::string& value) const
-{
- if (impl.get())
- return impl->read_string(name, value);
- else
- return false;
-}
-
-bool
-FileReader::read_vector(const char* name, Vector3f& value) const
-{
- if (impl.get())
- return impl->read_vector(name, value);
- else
- return false;
-}
-
-bool
-FileReader::read_color(const char* name, Color& value) const
-{
- if (impl.get())
- return impl->read_color(name, value);
- else
- return false;
-}
-
-bool
-FileReader::read_desc(const char* name, ResDescriptor& desc) const
-{
- if (impl.get())
- return impl->read_desc(name, desc);
- else
- return false;
-}
-
-bool
-FileReader::read_size (const char* name, Size& value) const
-{
- if (impl.get())
- return impl->read_size(name, value);
- else
- return false;
-}
-
-bool
-FileReader::read_vector2i(const char* name, Vector2i& value) const
-{
- if (impl.get())
- return impl->read_vector2i(name, value);
- else
- return false;
-}
-
-bool
-FileReader::read_section(const char* name, FileReader& reader) const
-{
- if (impl.get())
- return impl->read_section(name, reader);
- else
- return false;
-}
-
-std::vector<std::string>
-FileReader::get_section_names() const
-{
- if (impl.get())
- return impl->get_section_names();
- else
- return std::vector<std::string>();
-}
-
-std::vector<FileReader>
-FileReader::get_sections() const
-{
- if (impl.get())
- return impl->get_sections();
- else
- return std::vector<FileReader>();
-}
-
-FileReader
-FileReader::read_section(const char* name) const
-{
- FileReader reader;
- read_section(name, reader);
- return reader;
-}
-
-FileReader
-FileReader::parse(const std::string& filename)
-{
- // FIXME: memory leak, somebody must delete the lisp::Lisp
- lisp::Lisp* sexpr = lisp::Parser::parse(filename);
- if (sexpr)
- {
- return SExprFileReader(sexpr->get_list_elem(0));
- }
- else
- {
- return FileReader();
- }
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/file_reader.hpp (from rev 2685,
branches/pingus_sdl/src/file_reader.hxx)
Deleted: branches/pingus_sdl/src/file_reader.hxx
===================================================================
--- branches/pingus_sdl/src/file_reader.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/file_reader.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,83 +0,0 @@
-// $Id: file_reader.hxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_FILE_READER_HXX
-#define HEADER_PINGUS_FILE_READER_HXX
-
-#include <string>
-#include <vector>
-#include "shared_ptr.hxx"
-
-class Size;
-class Color;
-class Vector3f;
-class Vector2i;
-
-class ResDescriptor;
-class FileReaderImpl;
-
-/** Interface to read name/value pairs out of some kind of file or
- structure */
-class FileReader
-{
-public:
- FileReader(SharedPtr<FileReaderImpl> impl_);
- FileReader();
-
- /** Name of the current section, ie. in the case of
- <groundpiece><pos>...</groundpiece> it would be 'groundpiece' */
- std::string get_name() const;
-
- bool read_int (const char* name, int&) const;
- bool read_float (const char* name, float&) const;
- bool read_bool (const char* name, bool&) const;
- bool read_string(const char* name, std::string&) const;
- bool read_vector(const char* name, Vector3f&) const;
- bool read_vector2i(const char* name, Vector2i&) const;
- bool read_size (const char* name, Size&) const;
- bool read_color (const char* name, Color&) const;
- //// bool read_size (const char* name, CL_Size&) const;
- bool read_desc (const char* name, ResDescriptor&) const;
- bool read_section(const char* name, FileReader&) const;
- FileReader read_section(const char* name) const;
-
- template<class E, class T>
- bool read_enum (const char* name, E& value, T enum2string) const
- {
- std::string str;
- if (read_string(name, str))
- {
- value = enum2string(str);
- return true;
- }
-
- return false;
- }
-
- std::vector<std::string> get_section_names() const;
- std::vector<FileReader> get_sections() const;
-
- static FileReader parse(const std::string& filename);
-private:
- SharedPtr<FileReaderImpl> impl;
-};
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/file_reader_impl.hpp (from rev 2685,
branches/pingus_sdl/src/file_reader_impl.hxx)
Deleted: branches/pingus_sdl/src/file_reader_impl.hxx
===================================================================
--- branches/pingus_sdl/src/file_reader_impl.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/file_reader_impl.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,60 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_FILE_READER_IMPL_HXX
-#define HEADER_FILE_READER_IMPL_HXX
-
-#include <vector>
-#include <string>
-
-class Size;
-class Color;
-class Vector3f;
-class Vector2i;
-
-class FileReader;
-class ResDescriptor;
-
-/** */
-class FileReaderImpl
-{
-public:
- FileReaderImpl() {}
- virtual ~FileReaderImpl() {}
-
- virtual std::string get_name() const =0;
- virtual bool read_int (const char* name, int&) const =0;
- virtual bool read_float (const char* name, float&) const =0;
- virtual bool read_bool (const char* name, bool&) const =0;
- virtual bool read_string(const char* name, std::string&) const =0;
- virtual bool read_vector(const char* name, Vector3f&) const =0;
- virtual bool read_size (const char* name, Size&) const =0;
- virtual bool read_vector2i(const char* name, Vector2i&) const =0;
- virtual bool read_color (const char* name, Color&) const =0;
- virtual bool read_desc (const char* name, ResDescriptor&) const =0;
- //// virtual bool read_size (const char* name, CL_Size&) const =0;
- virtual bool read_section(const char* name, FileReader&) const =0;
- virtual std::vector<FileReader> get_sections() const =0;
- virtual std::vector<std::string> get_section_names() const =0;
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/file_writer.hpp (from rev 2685,
branches/pingus_sdl/src/file_writer.hxx)
Deleted: branches/pingus_sdl/src/file_writer.hxx
===================================================================
--- branches/pingus_sdl/src/file_writer.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/file_writer.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,49 +0,0 @@
-// $Id: file_writer.hxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_FILE_WRITER_HXX
-#define HEADER_PINGUS_FILE_WRITER_HXX
-
-#include <string>
-
-
-class Vector;
-
-/** Interface to write out name/value pairs out of some kind of file or
- structure */
-class FileWriter
-{
-private:
-public:
- virtual ~FileWriter() {}
-
- virtual void begin_section (const char* name) =0;
- virtual void end_section () =0;
-
- virtual void write_int (const char* name, int) =0;
- virtual void write_float (const char* name, float) =0;
- virtual void write_bool (const char* name, bool) =0;
- virtual void write_string (const char* name, const std::string&) =0;
- virtual void write_vector (const char* name, const Vector&) =0;
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/fonts.cpp (from rev 2685,
branches/pingus_sdl/src/fonts.cxx)
Deleted: branches/pingus_sdl/src/fonts.cxx
===================================================================
--- branches/pingus_sdl/src/fonts.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/fonts.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,78 +0,0 @@
-// $Id: fonts.cxx,v 1.8 2003/12/13 23:41:11 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "resource.hxx"
-#include "fonts.hxx"
-
-namespace Fonts {
-
-std::string encoding("ISO-8859-1");
-
-Font chalk_large;
-Font chalk_normal;
-Font chalk_small;
-
-Font pingus_small;
-Font pingus_small_fix_num;
-Font pingus_large;
-
-Font smallfont;
-Font smallfont_h;
-
-Font courier_small;
-Font xterm;
-Font lcd;
-
-void
-init ()
-{
- chalk_large = Resource::load_font("fonts/chalk_large" + std::string(".") +
encoding);
- chalk_normal = Resource::load_font("fonts/chalk_normal" + std::string(".") +
encoding);
- chalk_small = Resource::load_font("fonts/chalk_small" + std::string(".") +
encoding);
-
- pingus_small = Resource::load_font("fonts/pingus_small" + std::string(".") +
encoding);
- pingus_small_fix_num = Resource::load_font("fonts/pingus_small_fix_num" +
std::string(".") + encoding);
- pingus_large = Resource::load_font("fonts/pingus" + std::string(".") +
encoding);
-
- courier_small = Resource::load_font("fonts/courier_small" + std::string(".")
+ encoding);
- xterm = Resource::load_font("fonts/courier_small" + std::string(".")
+ encoding);
- smallfont = Resource::load_font("fonts/courier_small" + std::string(".")
+ encoding); //PingusResource::load_font("Fonts/smallfont","fonts");
- smallfont_h = Resource::load_font("fonts/courier_small" + std::string(".")
+ encoding); // PingusResource::load_font("Fonts/smallfont_h","fonts");
-
- lcd = Resource::load_font("fonts/courier_small" + std::string(".")
+ encoding); // PingusResource::load_font("Fonts/numbers", "fonts");
-}
-
-void deinit ()
-{
- chalk_large = Font();
- chalk_normal = Font();
- chalk_small = Font();
- pingus_small = Font();
- pingus_small_fix_num = Font();
- pingus_large = Font();
- courier_small = Font();
- xterm = Font();
- smallfont = Font();
- smallfont_h = Font();
- lcd = Font();
-}
-
-} // namespace Fonts
-
-/* EOF */
Copied: branches/pingus_sdl/src/fonts.hpp (from rev 2685,
branches/pingus_sdl/src/fonts.hxx)
Deleted: branches/pingus_sdl/src/fonts.hxx
===================================================================
--- branches/pingus_sdl/src/fonts.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/fonts.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,55 +0,0 @@
-// $Id: fonts.hxx,v 1.7 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_FONTS_HXX
-#define HEADER_PINGUS_FONTS_HXX
-
-#include "display/drawing_context.hxx"
-#include "font.hpp"
-
-namespace Fonts {
-
-extern std::string encoding;
-
-extern Font chalk_large;
-extern Font chalk_normal;
-extern Font chalk_small;
-
-extern Font courier_small;
-
-extern Font pingus_small;
-extern Font pingus_small_fix_num;
-extern Font pingus_large;
-
-extern Font smallfont;
-extern Font smallfont_h;
-extern Font xterm;
-extern Font lcd;
-
-/** Load all fonts */
-void init ();
-
-/** Unload fonts */
-void deinit ();
-
-} // namespace Fonts
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/fps_counter.cpp (from rev 2685,
branches/pingus_sdl/src/fps_counter.cxx)
Deleted: branches/pingus_sdl/src/fps_counter.cxx
===================================================================
--- branches/pingus_sdl/src/fps_counter.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/fps_counter.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,97 +0,0 @@
-// $Id: fps_counter.cxx,v 1.11 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <stdio.h>
-#include "fonts.hxx"
-#include "fps_counter.hxx"
-#include "gettext.h"
-
-
-FPSCounter fps_counter;
-
-FPSCounter::FPSCounter()
-{
-}
-
-FPSCounter::~FPSCounter()
-{
- font = Font();
-}
-
-// We are not initialising the fpscounter in the constructor, 'cause
-// that doesn't work (ClanLib hasn't init the display at that point)
-void
-FPSCounter::init()
-{
- font = Fonts::pingus_small;
- font.set_alignment(origin_top_right);
- start_time = SDL_GetTicks();
- strcat(fps_string, _("unknown"));
- fps_count = 0;
-}
-
-// Get rid of any ClanLib objects that might want to linger after
-// we unload all of our resources.
-void FPSCounter::deinit()
-{
- font = Font();
-}
-
-void
-FPSCounter::on_event()
-{
- update_fps_counter();
-
- if (odd_frame)
- {
- font.draw(Display::get_width(),
- Display::get_height() - (2 * font.get_height()),
- "o");
-
- odd_frame = false;
- }
- else
- {
- odd_frame = true;
- }
-
- font.draw(Display::get_width(),
- Display::get_height() - font.get_height(),
- fps_string);
-}
-
-void
-FPSCounter::update_fps_counter()
-{
- unsigned int current_time = SDL_GetTicks();
- int current_fps;
-
- fps_count++;
-
- if (start_time + 1000 < current_time)
- {
- current_fps = fps_count * 1000 / (current_time - start_time);
- snprintf(fps_string, 16, "%d fps", current_fps);
- fps_count = 0;
- start_time = SDL_GetTicks();
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/fps_counter.hpp (from rev 2685,
branches/pingus_sdl/src/fps_counter.hxx)
Deleted: branches/pingus_sdl/src/fps_counter.hxx
===================================================================
--- branches/pingus_sdl/src/fps_counter.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/fps_counter.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,78 +0,0 @@
-// $Id: fps_counter.hxx,v 1.10 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_FPS_COUNTER_HXX
-#define HEADER_PINGUS_FPS_COUNTER_HXX
-
-#include "gui/display.hxx"
-
-
-///
-class FPSCounter : public DisplayHook
-{
-private:
- /** The font... */
- Font font;
-
- /** Used to know when the frame has changed */
- bool odd_frame;
-
- /** A string holding the current value of frames + "fps", its
- updated every second */
- char fps_string[16];
-
- /** Count the fps until one second is passed */
- int fps_count;
-
- /** The time were the last fps string update was performent */
- unsigned int start_time;
-
- /** Check if one second is passed and if that is the case, update
- everything then. */
- virtual void update_fps_counter();
-
-public:
- ///
- FPSCounter();
- ///
- virtual ~FPSCounter();
-
- /** When we got a Display::flip_display() this function is
- called... */
- virtual void on_event();
-
- /** Load all the gfx and fonts... */
- void init();
-
- /** Unload gfx and fonts... */
- void deinit();
-
-private:
- FPSCounter (const FPSCounter&);
- FPSCounter& operator= (const FPSCounter&);
-};
-
-/** The fps_counter is a global object, so we don't need to construct
- it over and over again */
-extern FPSCounter fps_counter;
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/game_event.hpp (from rev 2685,
branches/pingus_sdl/src/game_event.hxx)
Deleted: branches/pingus_sdl/src/game_event.hxx
===================================================================
--- branches/pingus_sdl/src/game_event.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/game_event.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,59 +0,0 @@
-// $Id: game_event.hxx,v 1.8 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GAME_EVENT_HXX
-#define HEADER_PINGUS_GAME_EVENT_HXX
-
-#error "Don't used this the moment, its underdevelopment and not compilable"
-
-#include "pingus.hxx"
-#include <string>
-
-
-/** This will need some^H^H^H^H a lot of work */
-typedef enum {
- /** Pointer Events (pos contains the move-delta) */
-
-} GameEventType;
-
-class GameEvent
-{
-public:
- /** When should the action happen? */
- int time_stamp;
-};
-
-class PinguGameEvent : public GameEvent
-{
- /** The id of the pingu to which this action should apply
- int pingu_id;
-
- /** The action to apply to the pingu */
- std::string action;
-};
-
-class ArmageddonGameEvent : public GameEvent
-{
- // nothing
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/game_session.cpp (from rev 2685,
branches/pingus_sdl/src/game_session.cxx)
Deleted: branches/pingus_sdl/src/game_session.cxx
===================================================================
--- branches/pingus_sdl/src/game_session.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/game_session.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,195 +0,0 @@
-// $Id: game_session.cxx,v 1.42 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "gui/screen_manager.hxx"
-#include "client.hxx"
-#include "true_server.hxx"
-#include "game_session.hxx"
-#include "game_session_result.hxx"
-#include "timer.hxx"
-#include "resource.hxx"
-#include "pingu_holder.hxx"
-#include "world.hxx"
-#include "result_screen.hxx"
-#include "savegame_manager.hxx"
-#include "globals.hxx"
-
-PingusGameSession::PingusGameSession (const PingusLevel& arg_plf, bool
arg_show_result_screen)
- : plf(arg_plf),
- show_result_screen(arg_show_result_screen)
-{
- Timer plf_timer("GameSession plf creation");
-
- plf_timer.stop();
-
- Timer server_timer("GameSession server creation");
- server = new TrueServer(plf);
- server_timer.stop();
-
- Timer client_timer("GameSession client creation");
- client = new Client(server);
- client_timer.stop();
-
- number_of_redraws = 0;
- number_of_updates = 0;
-
- left_over_time = 0;
- std::cout << "PingusGameSession" << std::endl;
-}
-
-PingusGameSession::~PingusGameSession ()
-{
- if (maintainer_mode)
- std::cout << "XXXXXXXX"
- << " Redraws: " << number_of_redraws
- << " Updates: " << number_of_updates
- << " FrameSkip: " << number_of_updates - number_of_redraws
- << std::endl;
-
- delete client;
- delete server;
-}
-
-void
-PingusGameSession::on_startup()
-{
- client->on_startup();
-}
-
-void
-PingusGameSession::on_shutdown()
-{
- client->on_shutdown();
-}
-
-PingusGameSessionResult
-PingusGameSession::get_result ()
-{
- return PingusGameSessionResult ();
-}
-
-bool
-PingusGameSession::draw(DrawingContext& gc)
-{
- ++number_of_redraws;
- client->draw (gc);
- return true;
-}
-
-void
-PingusGameSession::update (const GameDelta& delta)
-{
- // FIXME: Timing code could need another rewrite...
- if (server->is_finished())
- {
- //ScreenManager::instance()->pop_screen();
- PinguHolder* pingu_holder = server->get_world()->get_pingus();
- Result result;
-
- result.plf = server->get_plf();
-
- result.saved = pingu_holder->get_number_of_exited();
- result.killed = pingu_holder->get_number_of_killed();
- result.total = server->get_plf().get_number_of_pingus();
-
- result.needed = server->get_plf().get_number_to_save();
-
- result.max_time = server->get_plf().get_time();
- result.used_time = server->get_time();
-
- { // Write the savegame
- Savegame savegame;
- savegame.levelname = result.plf.get_levelname();
- savegame.needed_time = result.used_time;
- savegame.saved_pingus = result.saved;
-
- if (result.saved >= result.needed)
- savegame.status = Savegame::FINISHED;
- else
- savegame.status = Savegame::ACCESSIBLE;
-
- SavegameManager::instance()->store(savegame);
- }
-
- if (show_result_screen)
- ScreenManager::instance()->replace_screen(new ResultScreen(result));
- else
- ScreenManager::instance()->pop_screen();
- return;
- }
-
- int time_passed = int(delta.get_time() * 1000) + left_over_time;
- int update_time = game_speed;
-
- left_over_time = 0;
-
- {
- int i;
- for (i = 0;
- ((i * update_time < time_passed)
- || i < min_frame_skip)
- && !(i > max_frame_skip);
- ++i)
- {
- // This updates the world and all objects
- server->update ();
- ++number_of_updates;
- }
-
- // Time that got not used for updates
- left_over_time = time_passed - (i * update_time);
- }
-
- if (left_over_time < 0)
- {
- // FIXME: This doesn't really belong here
- SDL_Delay(-left_over_time);
- }
-
- // Client is independend of the update limit, well, not completly...
- client->update (delta);
-}
-
-void
-PingusGameSession::on_pause_press ()
-{
- client->on_pause_press ();
-}
-
-void
-PingusGameSession::on_fast_forward_press ()
-{
- client->on_fast_forward_press ();
-}
-
-void
-PingusGameSession::on_armageddon_press ()
-{
- client->on_armageddon_press ();
-}
-
-void
-PingusGameSession::on_escape_press ()
-{
- client->on_escape_press ();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/game_session.hpp (from rev 2685,
branches/pingus_sdl/src/game_session.hxx)
Deleted: branches/pingus_sdl/src/game_session.hxx
===================================================================
--- branches/pingus_sdl/src/game_session.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/game_session.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,91 +0,0 @@
-// $Id: game_session.hxx,v 1.21 2003/10/20 19:28:54 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GAME_SESSION_HXX
-#define HEADER_PINGUS_GAME_SESSION_HXX
-
-#include <string>
-#include "gui/screen.hxx"
-#include "pingus_level.hxx"
-
-
-class Client;
-class TrueServer;
-class PingusGameSessionResult;
-class DemoPlayer;
-
-/** You can use this class to start up a game session, which consist
- of a single level. */
-class PingusGameSession : public Screen
-{
-private:
- /// The level data
- PingusLevel plf;
-
- bool show_result_screen;
-
- /// The server
- TrueServer* server;
-
- /// The client
- Client* client;
-
- /** Time in 1/1000 second's that was not used in the last
- update() */
- int left_over_time;
-
- /** Number of updates */
- unsigned int number_of_updates;
-
- /** Number of redraws (frameskip == number_of_updates - number_of_redraws) */
- unsigned int number_of_redraws;
-
-public:
- PingusGameSession(const PingusLevel& arg_plf, bool arg_show_result_screen);
-
- /** Clean up */
- ~PingusGameSession ();
-
- /** Get the results of the last gaming session */
- PingusGameSessionResult get_result ();
-
- // Overloaded Screen functions
- /** Draw this screen */
- bool draw(DrawingContext& gc);
-
- /** Pass a delta to the screen */
- void update (const GameDelta& delta);
-
- void on_startup();
- void on_shutdown();
-
- void on_pause_press ();
- void on_fast_forward_press ();
- void on_armageddon_press ();
- void on_escape_press ();
-
-private:
- PingusGameSession (const PingusGameSession&);
- PingusGameSession& operator= (const PingusGameSession&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/game_session_result.cpp (from rev 2685,
branches/pingus_sdl/src/game_session_result.cxx)
Deleted: branches/pingus_sdl/src/game_session_result.cxx
===================================================================
--- branches/pingus_sdl/src/game_session_result.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/game_session_result.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,47 +0,0 @@
-// $Id: game_session_result.cxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "game_session_result.hxx"
-
-
-PingusGameSessionResult::PingusGameSessionResult ()
-{
-}
-
-bool
-PingusGameSessionResult::finished ()
-{
- // FIXME: Always success
- return true;
-}
-
-float
-PingusGameSessionResult::percentage_saved ()
-{
- return 100.0;
-}
-
-float
-PingusGameSessionResult::percentage_time ()
-{
- return 100.0;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/game_session_result.hpp (from rev 2685,
branches/pingus_sdl/src/game_session_result.hxx)
Deleted: branches/pingus_sdl/src/game_session_result.hxx
===================================================================
--- branches/pingus_sdl/src/game_session_result.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/game_session_result.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,51 +0,0 @@
-// $Id: game_session_result.hxx,v 1.7 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GAME_SESSION_RESULT_HXX
-#define HEADER_PINGUS_GAME_SESSION_RESULT_HXX
-
-#include "pingus.hxx"
-
-
-/** With this class you can obtain information about the success or
- failure of a level, in addition you can get details like how many
- penguins where saved or killed, etc. */
-class PingusGameSessionResult
-{
-public:
- PingusGameSessionResult ();
-
- PingusGameSessionResult (const PingusGameSessionResult&) { }
- PingusGameSessionResult& operator= (const PingusGameSessionResult&) { return
*this; }
-
- /** Gives information if the level was succeeded or not
- @return true if the level was succeeded, otherwise false */
- bool finished ();
-
- /** @return The percentage of pingus which where saved in this level */
- float percentage_saved ();
-
- /** @return The percentage of time, which was used to finish this level */
- float percentage_time ();
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/game_time.cpp (from rev 2685,
branches/pingus_sdl/src/game_time.cxx)
Deleted: branches/pingus_sdl/src/game_time.cxx
===================================================================
--- branches/pingus_sdl/src/game_time.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/game_time.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,88 +0,0 @@
-// $Id: game_time.cxx,v 1.11 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <stdio.h>
-#include "gettext.h"
-#include "globals.hxx"
-#include "game_time.hxx"
-
-
-GameTime::GameTime (int arg_tick_time)
- : count (0), tick_time (arg_tick_time)
-{
-}
-
-int
-GameTime::get_time ()
-{
- return count * game_speed;
-}
-
-int
-GameTime::get_ticks(void)
-{
- return count;
-}
-
-int
-GameTime::get_tick_time ()
-{
- return game_speed;
-}
-
-void
-GameTime::update(void)
-{
- count += 1;
-}
-
-void
-GameTime::reset(void)
-{
- count = 0;
-}
-
-std::string
-GameTime::ticks_to_realtime_string(int ticks)
-{
- const int time_str_size = 20;
- char time_str[time_str_size];
-
- if (ticks == -1)
- {
- snprintf(time_str, time_str_size, _("unlimited"));
- }
- else
- {
- int total_seconds = ticks * game_speed / 1000;
- int seconds = total_seconds % 60;
- int minutes = total_seconds / 60;
-
- // Stop displaying negative seconds, which can happen if armageddon is
- // clicked with 1 second left.
- if (seconds < 0)
- seconds = 0;
-
- snprintf(time_str, time_str_size, "%2d:%02d", minutes, seconds);
- }
- return time_str;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/game_time.hpp (from rev 2685,
branches/pingus_sdl/src/game_time.hxx)
Deleted: branches/pingus_sdl/src/game_time.hxx
===================================================================
--- branches/pingus_sdl/src/game_time.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/game_time.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,69 +0,0 @@
-// $Id: game_time.hxx,v 1.11 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GAME_TIME_HXX
-#define HEADER_PINGUS_GAME_TIME_HXX
-
-#include "pingus.hxx"
-
-
-/** The GameTime represents the time which passes in the Pingus World.
- Its behaviour is analogue to CL_System::get_time (), but with the
- difference that it only increases if the game runs, if the game is
- in pause mode, the time will not continue. */
-class GameTime
-{
-private:
- /** Tick counter */
- int count;
-
- /** How long does a tick take in msec */
- int tick_time;
-
-public:
- GameTime (int arg_tick_time);
-
- /** Number of ticks since the time starts, a tick is one basically
- update call to the world */
- int get_ticks(void);
-
- /** Return the passed time in miliseconds (1000msec = 1sec) */
- int get_time ();
-
- /** Return in realtime (milisecondons ) how long a tick normally takes */
- int get_tick_time ();
-
- /** Increase the tick count */
- void update(void);
-
- /** Start from zero */
- void reset(void);
-
- /** Convert time given in ticks, into a string of Minutes:Seconds */
- static std::string ticks_to_realtime_string(int ticks);
-
-private:
- GameTime (const GameTime&);
- GameTime& operator= (const GameTime&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gettext.cpp (from rev 2685,
branches/pingus_sdl/src/gettext.cxx)
Deleted: branches/pingus_sdl/src/gettext.cxx
===================================================================
--- branches/pingus_sdl/src/gettext.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/gettext.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,24 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "gettext.h"
-
-TinyGetText::DictionaryManager dictionary_manager;
-
-/* EOF */
Copied: branches/pingus_sdl/src/global_event.cpp (from rev 2685,
branches/pingus_sdl/src/global_event.cxx)
Deleted: branches/pingus_sdl/src/global_event.cxx
===================================================================
--- branches/pingus_sdl/src/global_event.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/global_event.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,109 +0,0 @@
-// $Id: global_event.cxx,v 1.15 2003/10/22 11:11:22 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <config.h>
-#include <stdio.h>
-#include <algorithm>
-#include <ClanLib/Display/keyboard.h>
-#include <ClanLib/Display/display.h>
-#include <ClanLib/Display/input_event.h>
-#include <ClanLib/Display/keys.h>
-#include "screenshot.hxx"
-#include "console.hxx"
-#include "fps_counter.hxx"
-#include "global_event.hxx"
-#include "globals.hxx"
-
-
-GlobalEvent global_event;
-
-GlobalEvent::GlobalEvent ()
-{
-}
-
-void
-GlobalEvent::on_button_press(const CL_InputEvent& event)
-{
- if (event.device.get_type() == CL_InputDevice::keyboard)
- {
- switch (event.id)
- {
- case CL_KEY_F1:
- console.toggle_display();
- break;
-
- case CL_KEY_F10:
- fps_counter.toggle_display();
- console << "Toggling fps counter display" << std::endl;
- break;
-
- case CL_KEY_F11:
- if (CL_Display::is_fullscreen())
- CL_Display::set_windowed();
- else
- CL_Display::set_fullscreen(CL_Display::get_width(),
- CL_Display::get_height(),
- 32);
- break;
-
- case CL_KEY_F12:
- {
- std::string filename;
- std::cout << "GlobalEvent::Making screenshot..." << std::endl;
- filename = Screenshot::make_screenshot();
- console << "GlobalEvent: Saved screenshot to \"" << filename <<
"\"" << std::endl;
- //console << "!\"#$%&'()*+,-./0123456789:;<=>?@";
- console.newline();
- }
- break;
-
- case CL_KEY_C:
- if (maintainer_mode)
- draw_collision_map = !draw_collision_map;
- break;
-
- case CL_KEY_M:
- if (CL_Keyboard::get_keycode(CL_KEY_LCONTROL) ||
CL_Keyboard::get_keycode(CL_KEY_RCONTROL) )
- {
- std::cout << "Maintainer Mode: " << maintainer_mode << std::endl;
- maintainer_mode = !maintainer_mode;
- }
- break;
-
- case CL_KEY_END:
- if (CL_Keyboard::get_keycode(CL_KEY_LCONTROL))
- {
- puts ("---:: Emergency exit ::---");
- exit (0);
- }
-
- default:
- // console << "GlobalEvent: Unknown key pressed: " << key.id;
- break;
- }
- }
-}
-
-void
-GlobalEvent::on_button_release(const CL_InputEvent& event)
-{
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/global_event.hpp (from rev 2685,
branches/pingus_sdl/src/global_event.hxx)
Deleted: branches/pingus_sdl/src/global_event.hxx
===================================================================
--- branches/pingus_sdl/src/global_event.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/global_event.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,48 +0,0 @@
-// $Id: global_event.hxx,v 1.9 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GLOBAL_EVENT_HXX
-#define HEADER_PINGUS_GLOBAL_EVENT_HXX
-
-#include "pingus.hxx"
-
-class CL_Key;
-class CL_InputDevice;
-
-
-class GlobalEvent
-{
-public:
- GlobalEvent ();
- virtual ~GlobalEvent() {}
-
- virtual void on_button_press(const CL_InputEvent& event);
- virtual void on_button_release(const CL_InputEvent& event);
-
-private:
- GlobalEvent (const GlobalEvent&);
- GlobalEvent& operator= (const GlobalEvent&);
-};
-
-extern GlobalEvent global_event;
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/globals.cpp (from rev 2685,
branches/pingus_sdl/src/globals.cxx)
Deleted: branches/pingus_sdl/src/globals.cxx
===================================================================
--- branches/pingus_sdl/src/globals.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/globals.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,69 +0,0 @@
-// $Id: globals.cxx,v 1.17 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "globals.hxx"
-
-
-int game_speed = 20;
-bool print_fps = false;
-int verbose = 0;
-bool music_enabled = true;
-bool sound_enabled = true;
-bool enable_demo_recording = true;
-bool play_demo = false;
-bool cursor_enabled = false;
-bool fast_mode = false;
-bool maintainer_mode = false;
-std::string demo_file;
-bool auto_scrolling = true;
-bool drag_drop_scrolling = false;
-int tile_size = 32;
-
-int screen_width = 800;
-int screen_height = 600;
-bool draw_collision_map = false;
-bool swcursor_enabled = false;
-std::string config_file;
-bool max_cpu_usage = true;
-bool action_help = true;
-bool show_input_debug_screen = false;
-bool render_preview = false;
-
-int min_frame_skip = 1;
-int max_frame_skip = 5;
-
-std::string controller_file;
-
-std::string global_username;
-std::string global_email;
-std::string default_language = "en";
-
-int pingus_debug_flags = 0;
-
-bool fullscreen_enabled = false;
-
-#if defined(WIN32) || defined(__APPLE__)
-// The clanSDL target is a little buggy on Windows and OSX - Use OpenGL by
default
-bool use_opengl = true;
-#else
-// Use the clanSDL target by default for systems other than Windows and OSX
(aka Linux).
-bool use_opengl = false;
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/globals.hpp (from rev 2685,
branches/pingus_sdl/src/globals.hxx)
Deleted: branches/pingus_sdl/src/globals.hxx
===================================================================
--- branches/pingus_sdl/src/globals.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/globals.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,91 +0,0 @@
-// $Id: globals.hxx,v 1.20 2003/12/13 11:21:23 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/** This file defines some global variables, most of them are used to
- keep the values of command line arguments. */
-
-#ifndef HEADER_PINGUS_GLOBALS_HXX
-#define HEADER_PINGUS_GLOBALS_HXX
-
-#include "pingus.hxx"
-#include <string>
-
-
-extern int game_speed; ///< -t, --set-speed
-extern bool print_fps; ///< --print-fps
-extern int verbose; ///< -v, --verbose
-
-extern bool music_enabled; ///< -m, --enable-music
-extern bool sound_enabled; ///< -s, --enable-sound
-
-extern bool enable_demo_recording;
-extern bool play_demo; ///< --play-demo
-
-extern bool cursor_enabled; ///< --enable-cursor
-extern bool debug_actions; ///< --debug-actions
-extern bool fast_mode; ///< --fast
-extern bool maintainer_mode; ///< --maintainer-mode
-extern std::string demo_file; ///<
-extern bool auto_scrolling; ///<
--enable-auto-scrolling
-extern bool drag_drop_scrolling;
-extern int tile_size; ///< --tile-size
-extern bool fullscreen_enabled; ///< --enable-fullscreen
-extern int screen_width; ///<
-extern int screen_height; ///<
-extern bool draw_collision_map; ///<
-extern bool swcursor_enabled; ///< --enable-swcursor
-
-extern std::string config_file; ///< --config-file
-extern std::string controller_file; ///< --controller
-
-extern bool max_cpu_usage; ///< --max-cpu-usage
-extern bool use_opengl; ///< --use-opengl
-extern bool action_help; ///< --action-help
-extern bool show_input_debug_screen; ///<
-extern bool render_preview; ///<
-
-extern std::string global_username; ///< The name of the
currently logged in user
-extern std::string global_email; ///< The email address of
the currently logged in user
-extern std::string default_language; ///< The default language,
which is used when the env var LANG is not set
-extern int pingus_debug_flags; ///< Set some bits in this
thing to get debug infos
-
-extern int min_frame_skip;
-extern int max_frame_skip;
-
-enum { PINGUS_DEBUG_ACTIONS = (1 << 0),
- PINGUS_DEBUG_SOUND = (1 << 1),
- PINGUS_DEBUG_GAMETIME = (1 << 2),
- PINGUS_DEBUG_TILES = (1 << 3),
- PINGUS_DEBUG_LOADING = (1 << 4),
-
- PINGUS_DEBUG_BLITTER = (1 << 6),
- PINGUS_DEBUG_TRANSLATOR = (1 << 7),
- PINGUS_DEBUG_RESOURCES = (1 << 8),
- PINGUS_DEBUG_GUI = (1 << 9),
- PINGUS_DEBUG_INPUT = (1 << 10),
- PINGUS_DEBUG_WORLDMAP = (1 << 11),
- PINGUS_DEBUG_PATHMGR = (1 << 12),
- PINGUS_DEBUG_DIRECTORIES = (1 << 13),
- PINGUS_DEBUG_ALL = (~0)
- };
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/goal_manager.cpp (from rev 2685,
branches/pingus_sdl/src/goal_manager.cxx)
Deleted: branches/pingus_sdl/src/goal_manager.cxx
===================================================================
--- branches/pingus_sdl/src/goal_manager.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/goal_manager.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,92 +0,0 @@
-// $Id: goal_manager.cxx,v 1.8 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "server.hxx"
-#include "world.hxx"
-#include "globals.hxx"
-#include "pingu_holder.hxx"
-#include "goal_manager.hxx"
-
-
-GoalManager::GoalManager(Server* s)
- : server(s), goal(GT_NONE), exit_time(0)
-{
-}
-
-bool
-GoalManager::is_finished()
-{
- if (goal == GT_NONE)
- {
- return false;
- }
- else if (exit_time == 0)
- {
- // we are finished, now wait a few second so that everybody can
- // see the particles, etc.
- if (maintainer_mode)
- std::cout << "XXXX goal reached: " << goal << std::endl;
- exit_time = server->get_time() + 125;
- return false;
- }
- else
- {
- return (exit_time < server->get_time());
- }
-}
-
-void
-GoalManager::update()
-{
- if (exit_time == 0)
- {
- World* world = server->get_world();
- PinguHolder* pingus = world->get_pingus();
- const PingusLevel& plf = server->get_plf();
-
- if (pingus->get_number_of_allowed() == pingus->get_number_of_released()
- && pingus->get_number_of_alive() == 0)
- {
- goal = GT_NO_PINGUS_IN_WORLD;
- }
- else if (pingus->get_number_of_alive() == 0 && world->check_armageddon())
- {
- goal = GT_ARMAGEDDON;
- }
- else if (plf.get_time() != -1
- && plf.get_time() <= server->get_time())
- {
- goal = GT_OUT_OF_TIME;
- }
- }
-}
-
-void
-GoalManager::set_abort_goal()
-{
- if (exit_time == 0)
- {
- goal = GT_GAME_ABORTED;
- exit_time = server->get_time();
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/goal_manager.hpp (from rev 2685,
branches/pingus_sdl/src/goal_manager.hxx)
Deleted: branches/pingus_sdl/src/goal_manager.hxx
===================================================================
--- branches/pingus_sdl/src/goal_manager.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/goal_manager.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,63 +0,0 @@
-// $Id: goal_manager.hxx,v 1.5 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GOAL_MANAGER_HXX
-#define HEADER_PINGUS_GOAL_MANAGER_HXX
-
-
-class Server;
-
-/** Class that looks at the server and searches for goal conditions,
- such no pingus in the world, time up or Escape pressed. */
-class GoalManager
-{
-private:
- Server* server;
-
- enum GoalType { GT_NONE, // No goal is reached
- GT_OUT_OF_TIME, // if the timelimit has passed
- GT_NO_PINGUS_IN_WORLD, // if all pingus are released and
exited/killed
- GT_ARMAGEDDON, // if armageddon as destroyed all pingus
- GT_GAME_ABORTED }; // if the user pressed Escape to exit the
level };
- GoalType goal;
-
- /** time at which is_finished() will return true */
- int exit_time;
-
-public:
- GoalManager(Server* plf);
-
- /** @return true if a goal is reached and the server can shutdown */
- bool is_finished();
-
- /** Abort the level */
- void set_abort_goal();
-
- /** Check for goal conditions and set finished accordingly */
- void update();
-
-private:
- GoalManager (const GoalManager&);
- GoalManager& operator= (const GoalManager&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/graphic_context_state.cpp (from rev 2685,
branches/pingus_sdl/src/graphic_context_state.cxx)
Deleted: branches/pingus_sdl/src/graphic_context_state.cxx
===================================================================
--- branches/pingus_sdl/src/graphic_context_state.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/graphic_context_state.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,278 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2004 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <math.h>
-#include "gui/display.hxx"
-#include "graphic_context_state.hxx"
-
-class GraphicContextStateImpl
-{
-public:
- int width;
- int height;
-
- Vector2f offset;
- float zoom;
- float rotation;
-
- bool have_limit;
- Rect limit;
-};
-
-GraphicContextState::GraphicContextState()
- : impl(new GraphicContextStateImpl())
-{
- impl->width = Display::get_width();
- impl->height = Display::get_height();
- impl->offset = Vector2f(0,0);
- impl->zoom = 1.0f;
- impl->rotation = 0;
- impl->have_limit = false;
-}
-
-GraphicContextState::GraphicContextState(int w, int h)
- : impl(new GraphicContextStateImpl())
-{
- impl->width = w;
- impl->height = h;
- impl->offset = Vector2f(0,0);
- impl->zoom = 1.0f;
- impl->rotation = 0;
- impl->have_limit = false;
-}
-
-void
-GraphicContextState::set_limit(const Rect& limit)
-{
- impl->have_limit = true;
- impl->limit = limit;
-}
-
-void
-GraphicContextState::set_unlimited()
-{
- impl->have_limit = false;
-}
-
-void
-GraphicContextState::set_size(int w, int h)
-{
- impl->width = w;
- impl->height = h;
-}
-
-void
-GraphicContextState::push(DrawingContext& gc)
-{
- gc.push_modelview();
-
- gc.translate((float)impl->width/2, (float)impl->height/2);
- gc.rotate(impl->rotation);
- gc.translate(-(float)impl->width/2, -(float)impl->height/2);
-
- gc.scale(get_zoom(), get_zoom());
- gc.translate(impl->offset.x, impl->offset.y);
-}
-
-void
-GraphicContextState::push(SceneContext& gc)
-{
- gc.push_modelview();
-
- gc.translate((float)impl->width/2, (float)impl->height/2);
- gc.rotate(impl->rotation);
- gc.translate(-(float)impl->width/2, -(float)impl->height/2);
-
- gc.scale(get_zoom(), get_zoom());
- gc.translate(impl->offset.x, impl->offset.y);
-}
-
-void
-GraphicContextState::pop (SceneContext& gc)
-{
- gc.pop_modelview();
-}
-
-void
-GraphicContextState::pop (DrawingContext& gc)
-{
- gc.pop_modelview();
-}
-
-#if 0
-void
-GraphicContextState::push(CL_GraphicContext* gc)
-{
- if (gc == 0)
- gc = CL_Display::get_current_window()->get_gc();
-
- gc->push_modelview();
-
- gc->add_translate(impl->width/2, impl->height/2);
- gc->add_rotate(impl->rotation, 0, 0, 1.0);
- gc->add_translate(-impl->width/2, -impl->height/2);
-
- gc->add_scale(get_zoom(), get_zoom());
- gc->add_translate(impl->offset.x, impl->offset.y);
-}
-
-void
-GraphicContextState::pop(CL_GraphicContext* gc)
-{
- if (gc == 0)
- gc = CL_Display::get_current_window()->get_gc();
-
- gc->pop_modelview();
-}
-#endif
-
-Rect
-GraphicContextState::get_clip_rect()
-{
- return Rect(Vector2i(int(-impl->offset.x),
- int(-impl->offset.y)),
- Size(int(get_width() / impl->zoom),
- int(get_height() / impl->zoom)));
-}
-
-void
-GraphicContextState::set_pos(const Vector2f& pos)
-{
- impl->offset.x = -pos.x + (get_width()/2 / impl->zoom);
- impl->offset.y = -pos.y + (get_height()/2 / impl->zoom);
-
- if (impl->have_limit)
- {
- if (-impl->offset.x < impl->limit.left)
- {
- impl->offset.x = -( impl->limit.left );
- }
- else if (-impl->offset.x + get_width() >= impl->limit.right)
- {
- impl->offset.x = -( impl->limit.right - get_width() - 1 );
- }
-
- if (-impl->offset.y < impl->limit.top)
- {
- impl->offset.y = -( impl->limit.top );
- }
- else if (-impl->offset.y + get_height() >= impl->limit.bottom)
- {
- impl->offset.y = -( impl->limit.bottom - get_height() - 1 );
- }
- }
-}
-
-Vector2f
-GraphicContextState::get_pos() const
-{
- return Vector2f(-impl->offset.x + (get_width()/2 / impl->zoom),
- -impl->offset.y + (get_height()/2 / impl->zoom));
-}
-
-void
-GraphicContextState::set_zoom(Vector2f pos, float z)
-{
- float old_zoom = impl->zoom;
- set_zoom(z);
- impl->offset.x = pos.x/impl->zoom - pos.x/old_zoom + impl->offset.x;
- impl->offset.y = pos.y/impl->zoom - pos.y/old_zoom + impl->offset.y;
-}
-
-void
-GraphicContextState::set_zoom(float z)
-{
- impl->zoom = z;
-}
-
-float
-GraphicContextState::get_zoom()
-{
- return impl->zoom;
-}
-
-void
-GraphicContextState::zoom_to (const Rectf& rect)
-{
- float center_x = (rect.left + rect.right) / 2.0f;
- float center_y = (rect.top + rect.bottom) / 2.0f;
-
- float width = rect.right - rect.left;
- float height = rect.bottom - rect.top;
- float screen_relation = float(get_height())/float(get_width ());
- float rect_relation = height/width;
-
- //std::cout << "Screen: " << screen_relation << " Zoom: " << rect_relation
<< std::endl;
- if (rect_relation < screen_relation) // take width, ignore height
- {
- impl->zoom = get_width()/width;
- }
- else // take height, ignore width
- {
- impl->zoom = get_height()/height;
- }
-
- impl->offset.x = (get_width() / (2*impl->zoom)) - center_x;
- impl->offset.y = (get_height() / (2*impl->zoom)) - center_y;
-}
-
-Vector2f
-GraphicContextState::screen2world(const Vector2i& pos_)
-{
- Vector2f pos(pos_.x, pos_.y);
- float sa = (float)sin(-impl->rotation/180.0f*M_PI);
- float ca = (float)cos(-impl->rotation/180.0f*M_PI);
-
- float dx = pos.x - (float)impl->width/2;
- float dy = pos.y - (float)impl->height/2;
-
- pos.x = impl->width/2 + (ca * dx - sa * dy);
- pos.y = impl->height/2 + (sa * dx + ca * dy);
-
- Vector2f p((float(pos.x) / impl->zoom) - impl->offset.x,
- (float(pos.y) / impl->zoom) - impl->offset.y);
-
- return p;
-}
-
-void
-GraphicContextState::set_rotation(float angle)
-{
- impl->rotation = angle;
-}
-
-float
-GraphicContextState::get_rotation()
-{
- return impl->rotation;
-}
-
-int
-GraphicContextState::get_width() const
-{
- return impl->width;
-}
-
-int
-GraphicContextState::get_height() const
-{
- return impl->height;
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/graphic_context_state.hpp (from rev 2685,
branches/pingus_sdl/src/graphic_context_state.hxx)
Deleted: branches/pingus_sdl/src/graphic_context_state.hxx
===================================================================
--- branches/pingus_sdl/src/graphic_context_state.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/graphic_context_state.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,95 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2004 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_GRAPHIC_CONTEXT_STATE_HXX
-#define HEADER_GRAPHIC_CONTEXT_STATE_HXX
-
-#include "math/rect.hpp"
-#include "math/vector3f.hpp"
-#include "math/vector2i.hpp"
-#include "math/vector2f.hpp"
-#include "shared_ptr.hxx"
-#include "display/drawing_context.hxx"
-#include "display/scene_context.hxx"
-
-class GraphicContextStateImpl;
-
-/** Helper class for capturing the state of a GraphicContext, with
- additional convenience functions to make handling GraphicContexts
- easier */
-class GraphicContextState
-{
-public:
- GraphicContextState();
- GraphicContextState(int w, int h);
-
- /** Limit the graphic context to the given limits rectangle, meaning
- that no point of the current visible region will be outside the
- limit */
- void set_limit(const Rect& limit);
- void set_unlimited();
-
- void set_size(int w, int h);
-
-#if 0
- void push(CL_GraphicContext* gc = 0);
- void pop (CL_GraphicContext* gc = 0);
-#endif
-
- void push(DrawingContext& gc);
- void pop (DrawingContext& gc);
-
- void push(SceneContext& gc);
- void pop (SceneContext& gc);
-
- /** Return a rectangle in world coordinates that represents the area
- visible on the screen */
- Rect get_clip_rect();
-
- int get_width() const;
- int get_height() const;
-
- /** Set the current rotation angel */
- void set_rotation(float angle);
-
- /** Return the current rotation angel */
- float get_rotation();
-
- /** Move the center of the visible area to pos */
- void set_pos(const Vector2f& pos);
- Vector2f get_pos() const;
-
- /** Set zoom to z, while ensuring that the screen position \a pos
- (normaly the position of the mouse pointer) stays in the same
- position even after zoomed in/out */
- void set_zoom(Vector2f pos, float z);
- void set_zoom(float z);
- float get_zoom();
-
- void zoom_to (const Rectf& rect);
-
- Vector2f screen2world(const Vector2i& pos);
-
-private:
- SharedPtr<GraphicContextStateImpl> impl;
-};
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/ground_map.cpp (from rev 2685,
branches/pingus_sdl/src/ground_map.cxx)
Deleted: branches/pingus_sdl/src/ground_map.cxx
===================================================================
--- branches/pingus_sdl/src/ground_map.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/ground_map.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,304 +0,0 @@
-// $Id: spot_map.cxx,v 1.31 2003/10/22 11:11:22 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <stdio.h>
-#include <iostream>
-#include "display/scene_context.hxx"
-#include "pingus_error.hxx"
-#include "blitter.hxx"
-#include "ground_map.hxx"
-#include "pingus_level.hxx"
-#include "gettext.h"
-#include "col_map.hxx"
-#include "math.hxx"
-
-MapTile::MapTile ()
-{
-}
-
-MapTile::~MapTile()
-{
-}
-
-void
-MapTile::prepare()
-{
-#if 0
- if (!pixelbuffer)
- {
- pixelbuffer = PixelBuffer(tile_size, tile_size, tile_size*4,
CL_PixelFormat::rgba8888);
- Blitter::clear_canvas(pixelbuffer);
- }
-#endif
- if (!pixelbuffer)
- {
- pixelbuffer = PixelBuffer(tile_size, tile_size);
- }
-}
-
-void
-MapTile::remove(PixelBuffer obj, int x, int y,
- int real_x, int real_y, GroundMap* parent)
-{
-#if 0
- if (surface)
- {
- parent->put_alpha_surface(pixelbuffer, obj, x, y, real_x, real_y);
- surface = CL_Surface(pixelbuffer);
- }
-#endif
-}
-
-void
-MapTile::put(PixelBuffer obj, int x, int y)
-{
- prepare();
- pixelbuffer.blit(obj, x, y);
- sprite = Sprite(pixelbuffer);
-}
-
-GroundMap::GroundMap(const PingusLevel& plf)
-{
- width = plf.get_size().width;
- height = plf.get_size().height;
-
- colmap = new ColMap(width, height);
-
- // Checking that the map has the correct size, only multiples of
- // tile_size are allowed, anything else wouldn't fit very well on
- // the colmap
- if ((width % tile_size) != 0)
- {
- width += (tile_size - (width % tile_size));
- }
-
- if ((height % tile_size) != 0)
- {
- height += (tile_size - (height % tile_size));
- }
-
- tile_width = width/tile_size;
- tile_height = height/tile_size;
-
- // Allocating tile map
- tile.resize(tile_width);
- for(unsigned int i=0; i < tile.size(); ++i)
- tile[i].resize(tile_height);
-
- // fix the height back to the correct values
- width = plf.get_size().width;
- height = plf.get_size().height;
-}
-
-GroundMap::~GroundMap(void)
-{
- delete colmap;
-}
-
-void
-GroundMap::draw_colmap(SceneContext& gc)
-{
- colmap->draw(gc.color());
-}
-
-// Draws the map with a offset, needed for scrolling
-void
-GroundMap::draw(SceneContext& gc)
-{
- const Rect& display = gc.color().get_clip_rect();
-
- // FIXME: delete the next four lines and replace them with gc.get_clip_rect()
- if (draw_collision_map)
- {
- draw_colmap(gc);
- }
- else
- {
- // Trying to calc which parts of the tilemap needs to be drawn
- int start_x = Math::max(0, display.left/tile_size);
- int start_y = Math::max(0, display.top/tile_size);
- int tilemap_width = display.get_width() / tile_size + 1;
- int tilemap_height = display.get_height() / tile_size + 1;
-
- // drawing the stuff
- for (int x = start_x; x <= (start_x + tilemap_width) && x <
int(tile.size()); ++x)
- for (int y = start_y; y <= start_y + tilemap_height && y <
int(tile[x].size()); ++y)
- {
- if (tile[x][y].get_sprite())
- {
- //std::cout << "Drawing GroundMap Tile " << std::endl;
- gc.color().draw(tile[x][y].get_sprite(),
- Vector3f(x * tile_size, y * tile_size));
- }
- else
- {
- if (pingus_debug_flags & PINGUS_DEBUG_TILES)
- gc.color().draw_fillrect(x * tile_size,
- y * tile_size,
- x * tile_size + tile_size,
- y * tile_size + tile_size,
- Color(255, 0, 0, 75));
- }
- }
- }
-}
-
-// Returns the width of the map, it is read directly from the *.psm file
-int
-GroundMap::get_width(void)
-{
- return width;
-}
-
-// Returns the height of the map, it is read directly from the *.psm file
-int
-GroundMap::get_height(void)
-{
- return height;
-}
-
-void
-GroundMap::remove(PixelBuffer sprovider, int x, int y)
-{
- // Get the start tile and end tile
- int start_x = Math::max(x / tile_size, 0);
- int start_y = Math::max(y / tile_size, 0);
- int end_x = Math::min((x + sprovider.get_width()) / tile_size,
- (width - 1) / tile_size);
- int end_y = Math::min((y + sprovider.get_height()) / tile_size,
- (height - 1) / tile_size);
-
- for(int ix = start_x; ix <= end_x; ++ix)
- for(int iy = start_y; iy <= end_y; ++iy)
- {
- tile[ix][iy].remove(sprovider, x - (ix * tile_size),
- y - (iy * tile_size), x, y, this);
- }
-}
-
-void
-GroundMap::put_alpha_surface(PixelBuffer provider, PixelBuffer sprovider,
- int x_pos, int y_pos, int real_x_arg, int
real_y_arg)
-{
-#if 0
- if (sprovider.get_format().get_depth() != 8)
- {
- PingusError::raise(std::string("SpotMap::put_alpha_surface: Image has
wrong color depth: "
- + sprovider.get_format().get_depth()));
- }
-
- provider.lock();
- sprovider.lock();
-
- int swidth = sprovider.get_width();
- int twidth = provider.get_width();
-
- int start_x = std::max(0, -x_pos);
- int start_y = std::max(0, -y_pos);
-
- int end_x = std::min(swidth, twidth - x_pos);
- int end_y = std::min(sprovider.get_height(), provider.get_height() - y_pos);
-
- if (end_x - start_x <= 0 || end_y - start_y <= 0)
- return;
-
- cl_uint8* target_buf = static_cast<cl_uint8*>(provider.get_data());
- cl_uint8* source_buf = static_cast<cl_uint8*>(sprovider.get_data());
-
- CL_Palette palette = sprovider.get_palette();
-
- if (sprovider.get_format().has_colorkey())
- {
- unsigned int colorkey = sprovider.get_format().get_colorkey();
-
- for (int y = start_y; y < end_y; ++y)
- {
- cl_uint8* tptr = target_buf + 4*((twidth*(y+y_pos)) + x_pos +
start_x);
- cl_uint8* sptr = source_buf + swidth*y + start_x;
-
- for (int x = start_x; x < end_x; ++x)
- {
- if (*sptr != colorkey && colmap->getpixel(real_x_arg+x,
real_y_arg+y) != Groundtype::GP_SOLID)
- { // FIXME: Slow?! if inside a blit loop probally not such a
good idea
- if (!CL_Endian::is_system_big())
- *tptr = 0;
- else
- tptr[3] = 0;
- }
-
- tptr += 4;
- sptr += 1;
- }
- }
- }
- else
- {
- for (int y = start_y; y < end_y; ++y)
- {
- cl_uint8* tptr = target_buf + 4*((twidth*(y+y_pos)) + x_pos +
start_x);
- cl_uint8* sptr = source_buf + swidth*y + start_x;
-
- for (int x = start_x; x < end_x; ++x)
- {
- if (colmap->getpixel(real_x_arg+x, real_y_arg+y) !=
Groundtype::GP_SOLID)
- { // FIXME: if inside blit loop might not be such a good idea
- if (!CL_Endian::is_system_big())
- *tptr = 0;
- else
- tptr[3] = 0;
- }
-
- tptr += 4;
- sptr += 1;
- }
- }
- }
-
- sprovider.unlock();
- provider.unlock();
-#endif
-}
-
-void
-GroundMap::put(PixelBuffer source, int x, int y)
-{
- // Get the start tile and end tile
- int start_x = std::max(0, x / tile_size);
- int start_y = std::max(0, y / tile_size);
- int end_x = std::min(tile_width, (x + source.get_width()) / tile_size +
1);
- int end_y = std::min(tile_height, (y + source.get_height()) / tile_size +
1);
-
- //std::cout << "GroundMap:put: " << source.get_width() << "x" <<
source.get_height() << std::endl;
-
- for(int ix = start_x; ix < end_x; ++ix)
- for(int iy = start_y; iy < end_y; ++iy)
- {
- tile[ix][iy].put(source,
- x - (ix * tile_size), y - (iy * tile_size));
- }
-}
-
-ColMap*
-GroundMap::get_colmap(void)
-{
- return colmap;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/ground_map.hpp (from rev 2685,
branches/pingus_sdl/src/ground_map.hxx)
Deleted: branches/pingus_sdl/src/ground_map.hxx
===================================================================
--- branches/pingus_sdl/src/ground_map.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/ground_map.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,109 +0,0 @@
-// $Id: spot_map.hxx,v 1.11 2003/10/22 11:11:22 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GROUND_MAP_HXX
-#define HEADER_PINGUS_GROUND_MAP_HXX
-
-#include <vector>
-#include "globals.hxx"
-#include "worldobj.hxx"
-#include "ground_map.hxx"
-#include "pixel_buffer.hpp"
-
-class SceneContext;
-class PingusLevel;
-class ColMap;
-class GroundMap;
-
-class MapTile
-{
-private:
- Sprite sprite;
- PixelBuffer pixelbuffer;
-
- void prepare();
-public:
- MapTile();
- ~MapTile();
-
- void remove(PixelBuffer, int x, int y, int real_x, int real_y, GroundMap*);
- void put(PixelBuffer, int x, int y);
-
- Sprite get_sprite() const { return sprite; }
-};
-
-/** This map type is the defaulh maptype, it is should be used for the
- most levels. It allows to construct a map, from a set of simple
- small images, this allows the generation of large map without
- using to much diskspace. */
-class GroundMap : public WorldObj
-{
-private:
- ColMap* colmap;
-
- /** The tiles out of which the map is constructed */
- std::vector<std::vector<MapTile> > tile;
-
- /** Width of the map */
- int width;
- /** Height of the map */
- int height;
-
- int tile_width;
- int tile_height;
-
-public:
- GroundMap(const PingusLevel& arg_plf);
- virtual ~GroundMap();
-
- void draw(SceneContext& gc);
-
- ColMap* get_colmap();
-
- int get_height();
- int get_width();
-
- /** Put the gives surface provider onto the given coordinates */
- void put(PixelBuffer, int x, int y);
-
- /** Remove the gives surface provider onto the given coordinates
- (everything non-transparent that isn't Groundtype::GP_Solid
- is removed from the map) */
- void remove(PixelBuffer, int x, int y);
-
- float get_z_pos () const { return 0; }
-
- /** Low level version of the remove() call, acts on a single tile
- instead of the complete map-tiles */
- void put_alpha_surface(PixelBuffer provider, PixelBuffer sprovider,
- int x, int y, int real_x, int real_y);
-
-private:
- /** Draw the collision map onto the screen */
- void draw_colmap(SceneContext& gc);
-
- GroundMap (const GroundMap&);
- GroundMap& operator= (const GroundMap&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/groundtype.cpp (from rev 2685,
branches/pingus_sdl/src/groundtype.cxx)
Deleted: branches/pingus_sdl/src/groundtype.cxx
===================================================================
--- branches/pingus_sdl/src/groundtype.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/groundtype.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,75 +0,0 @@
-// $Id: groundtype.cxx,v 1.3 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "groundtype.hxx"
-
-
-Groundtype::GPType
-Groundtype::string_to_type(const std::string& arg_type)
-{
- if (arg_type == "solid")
- return Groundtype::GP_SOLID;
- else if (arg_type == "transparent")
- return Groundtype::GP_TRANSPARENT;
- else if (arg_type == "ground")
- return Groundtype::GP_GROUND;
- else if (arg_type == "bridge")
- return Groundtype::GP_BRIDGE;
- else if (arg_type == "water")
- return Groundtype::GP_WATER;
- else if (arg_type == "lava")
- return Groundtype::GP_LAVA;
- else if (arg_type == "remove")
- return Groundtype::GP_REMOVE;
- else
- {
- std::cout << "Groundtype: Unhandled type: " << arg_type << std::endl;
- return Groundtype::GP_GROUND;
- }
-}
-
-
-std::string
-Groundtype::type_to_string(GPType arg_type)
-{
- switch (arg_type)
- {
- case Groundtype::GP_SOLID:
- return "solid";
- case Groundtype::GP_TRANSPARENT:
- return "transparent";
- case Groundtype::GP_GROUND:
- return "ground";
- case Groundtype::GP_BRIDGE:
- return "bridge";
- case Groundtype::GP_WATER:
- return "water";
- case Groundtype::GP_LAVA:
- return "lava";
- case Groundtype::GP_REMOVE:
- return "remove";
- default:
- std::cout << "Groundtype: Unhandled type: " << arg_type << std::endl;
- return "ground";
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/groundtype.hpp (from rev 2685,
branches/pingus_sdl/src/groundtype.hxx)
Deleted: branches/pingus_sdl/src/groundtype.hxx
===================================================================
--- branches/pingus_sdl/src/groundtype.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/groundtype.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,51 +0,0 @@
-// $Id: groundtype.hxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GROUNDTYPE_HXX
-#define HEADER_PINGUS_GROUNDTYPE_HXX
-
-#include <string>
-
-
-/** This class olds the definitions of the different types of ground
- available in pingus, it might also provide converter function from
- GPType to std::string and vice verse. */
-class Groundtype
-{
-public:
- enum GPType {
- GP_NOTHING,
- GP_SOLID,
- GP_TRANSPARENT,
- GP_GROUND,
- GP_BRIDGE,
- GP_WATER,
- GP_LAVA,
- GP_REMOVE,
- GP_OUTOFSCREEN
- };
-
- static GPType string_to_type (const std::string& arg_type);
- static std::string type_to_string (GPType arg_type);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/buffer_graphic_context.cpp (from rev 2685,
branches/pingus_sdl/src/gui/buffer_graphic_context.cxx)
Deleted: branches/pingus_sdl/src/gui/buffer_graphic_context.cxx
===================================================================
--- branches/pingus_sdl/src/gui/buffer_graphic_context.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/gui/buffer_graphic_context.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,107 +0,0 @@
-// $Id: buffer_graphic_context.cxx,v 1.6 2004/04/02 18:13:00 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../pingus_error.hxx"
-#include "../blitter.hxx"
-#include "../screenshot.hxx"
-#include "buffer_graphic_context.hxx"
-
-
-BufferGraphicContext::BufferGraphicContext(int width, int height)
- : canvas(width, height, width*4, CL_PixelFormat::rgba8888)
-{
-}
-
-BufferGraphicContext::~BufferGraphicContext()
-{
-}
-
-CL_Rect
-BufferGraphicContext::get_clip_rect()
-{
- return CL_Rect(0,0, get_width(), get_height());
-}
-
-void
-BufferGraphicContext::clear (float r, float g, float b)
-{
- UNUSED_ARG(r);
- UNUSED_ARG(g);
- UNUSED_ARG(b);
- std::cout << "BufferGraphicContext: clear" << std::endl;
-}
-
-void
-BufferGraphicContext::draw(CL_Sprite, const Vector3f&)
-{
-}
-
-void
-BufferGraphicContext::draw(CL_Sprite, const Vector3f&, int)
-{
-}
-
-void
-BufferGraphicContext::draw (CL_Surface sur, int x_pos, int y_pos)
-{
- //std::cout << "BufferGraphicContext: " << x_pos << ", " << y_pos <<
std::endl;
- try {
- Blitter::put_surface(canvas, sur.get_pixeldata(), x_pos, y_pos);
- } catch (PingusError& err) {
- std::cout << "BufferGraphicContext: " << err.get_message() << std::endl;
- }
-}
-
-void
-BufferGraphicContext::draw (CL_Surface sur, int x_pos, int y_pos, int frame)
-{
- //std::cout << "BufferGraphicContext: " << x_pos << ", " << y_pos << "
frame: " << frame << std::endl;
- try {
- Blitter::put_surface(canvas, sur.get_pixeldata(), x_pos, y_pos);
- } catch (PingusError& err) {
- std::cout << "BufferGraphicContext: " << err.get_message() << std::endl;
- }
- UNUSED_ARG(frame);
-}
-
-void
-BufferGraphicContext::draw (CL_Surface sur, int x_pos, int y_pos,
- float size_x, float size_y, int frame)
-{
- std::cout << "BufferGraphicContext: unsupported" << std::endl;
- UNUSED_ARG(sur);
- UNUSED_ARG(x_pos);
- UNUSED_ARG(y_pos);
- UNUSED_ARG(size_x);
- UNUSED_ARG(size_y);
- UNUSED_ARG(frame);
-}
-
-void
-BufferGraphicContext::write(const std::string& filename)
-{
- std::cout << "BufferGraphicContext::write: " << filename << std::endl;
- canvas.lock();
- Screenshot::save_target_to_file(canvas, filename);
- canvas.unlock();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/buffer_graphic_context.hpp (from rev 2685,
branches/pingus_sdl/src/gui/buffer_graphic_context.hxx)
Deleted: branches/pingus_sdl/src/gui/buffer_graphic_context.hxx
===================================================================
--- branches/pingus_sdl/src/gui/buffer_graphic_context.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/gui/buffer_graphic_context.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,97 +0,0 @@
-// $Id: buffer_graphic_context.hxx,v 1.6 2004/04/02 18:13:00 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_BUFFER_GRAPHIC_CONTEXT_HXX
-#define HEADER_PINGUS_BUFFER_GRAPHIC_CONTEXT_HXX
-
-#include <string>
-#include "../vector.hxx"
-#include "graphic_context.hxx"
-
-class CL_Surface;
-class CL_Font;
-
-
-typedef CL_Font FontHandle;
-
-/** Abstract interface */
-class BufferGraphicContext : public GraphicContext
-{
-private:
- CL_PixelBuffer canvas;
-
-public:
- BufferGraphicContext(int width, int height);
- virtual ~BufferGraphicContext();
-
- Vector get_offset () { return Vector(); }
- void set_offset (float, float) {}
-
- CL_Rect get_clip_rect ();
-
- float get_x_offset () { return 0; }
- float get_y_offset () { return 0; }
-
- int get_width () { return canvas.get_width(); }
- int get_height () { return canvas.get_height(); }
-
- float get_zoom () { return 1.0f; }
- void set_zoom (float new_zoom) { UNUSED_ARG(new_zoom); }
-
- void zoom_to (const CL_Rect & rect) { UNUSED_ARG(rect); }
- void move (const Vector & delta) { UNUSED_ARG(delta); }
-
- Vector screen_to_world (Vector pos) { return pos; }
- Vector world_to_screen (Vector pos) { return pos; }
-
- void clear (float r, float g, float b);
-
- void draw(CL_Sprite, const Vector3f&);
- void draw(CL_Sprite, const Vector3f&, int);
-
- void draw (CL_Surface sur, int x_pos, int y_pos);
- void draw (CL_Surface sur, int x_pos, int y_pos, int frame);
- void draw (CL_Surface sur, int x_pos, int y_pos,
- float size_x, float size_y, int frame);
-
- void draw_line (const Vector& /*pos1*/, const Vector& /*pos2*/,
- float /*r*/, float /*g*/, float /*b*/, float a = 1.0f) {
UNUSED_ARG(a); }
- void draw_line (int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/,
- float /*r*/, float /*g*/, float /*b*/, float a = 1.0f) {
UNUSED_ARG(a); }
- void draw_fillrect (int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/,
- float /*r*/, float /*g*/, float /*b*/, float a = 1.0f) {
UNUSED_ARG(a); }
- void draw_rect (int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/,
- float /*r*/, float /*g*/, float /*b*/, float a = 1.0f) {
UNUSED_ARG(a); }
- void draw_pixel (int /*x_pos*/, int /*y_pos*/,
- float /*r*/, float /*g*/, float /*b*/, float a = 1.0f) {
UNUSED_ARG(a); }
- void draw_circle (int /*x_pos*/, int /*y_pos*/, int /*radius*/,
- float /*r*/, float /*g*/, float /*b*/, float a = 1.0f) {
UNUSED_ARG(a); }
-
- void print_left (FontHandle /*font*/, int /*x_pos*/, int /*y_pos*/, const
std::string& /*str*/) {}
- void print_center (FontHandle /*font*/, int /*x_pos*/, int /*y_pos*/, const
std::string& /*str*/) {}
- void print_right (FontHandle /*font*/, int /*x_pos*/, int /*y_pos*/, const
std::string& /*str*/) {}
-
- /** Write the current content of the buffer down to a pnm file */
- void write(const std::string& filename);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/button.hpp (from rev 2685,
branches/pingus_sdl/src/gui/button.hxx)
Deleted: branches/pingus_sdl/src/gui/button.hxx
===================================================================
--- branches/pingus_sdl/src/gui/button.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/button.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,44 +0,0 @@
-// $Id: button.hxx,v 1.6 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUI_BUTTON_HXX
-#define HEADER_PINGUS_GUI_BUTTON_HXX
-
-#include "../pingus.hxx"
-
-namespace GUI {
-class Button
-{
-protected:
- bool pressed;
- bool mouse_over;
-
-public:
- void on_primary_button_press (int x, int y);
- void on_primary_button_release (int x, int y);
-
- void on_pointer_enter ();
- void on_pointer_leave ();
-};
-
-} // namespace GUI
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/checkbox.cpp (from rev 2685,
branches/pingus_sdl/src/gui/checkbox.cxx)
Deleted: branches/pingus_sdl/src/gui/checkbox.cxx
===================================================================
--- branches/pingus_sdl/src/gui/checkbox.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/checkbox.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,68 +0,0 @@
-// $Id: checkbox.cxx,v 1.00 2006/1/15 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2006 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "checkbox.hxx"
-#include "../fonts.hxx"
-#include "../math/vector3f.hpp"
-#include "../resource.hxx"
-#include "../display/drawing_context.hxx"
-#include "../gui/checkbox_listener.hxx"
-
-
-namespace GUI {
-
-Checkbox::Checkbox(Vector3f p, std::string label_, CheckboxListener* l) :
- checkmark(Resource::load_sprite("core/misc/checkbox_clicked")),
- is_checked(false),
- pos(p),
- width(20),
- height(20),
- listener(l),
- label(label_)
-{
-}
-
-void
-Checkbox::draw(DrawingContext& gc)
-{
- gc.draw_rect(pos.x, pos.y, pos.x + width, pos.y + height,
- Color(0,0,0));
- if (is_checked)
- gc.draw(checkmark, pos);
-
- gc.print_right(Fonts::smallfont, pos.x, pos.y, label);
-}
-
-bool
-Checkbox::is_at(int x, int y)
-{
- return (x > pos.x && x < pos.x + width &&
- y > pos.y && y < pos.y + height);
-}
-
-void
-Checkbox::on_primary_button_click(int x, int y)
-{
- is_checked = !is_checked;
- listener->checkbox_changed(is_checked, this);
-}
-
-} // GUI namespace
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/checkbox.hpp (from rev 2685,
branches/pingus_sdl/src/gui/checkbox.hxx)
Deleted: branches/pingus_sdl/src/gui/checkbox.hxx
===================================================================
--- branches/pingus_sdl/src/gui/checkbox.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/checkbox.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,64 +0,0 @@
-// $Id: checkbox.hxx,v 1.00 2006/1/15 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2006 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUI_CHECKBOX_HXX
-#define HEADER_PINGUS_GUI_CHECKBOX_HXX
-
-#include "../gui/component.hxx"
-#include "../math/vector3f.hpp"
-#include "../sprite.hpp"
-
- class DrawingContext;
-
-namespace GUI {
-
- class CheckboxListener;
-
-class Checkbox : public GUI::Component
-{
-private:
- Sprite box;
- Sprite checkmark;
-
- bool is_checked;
- Vector3f pos;
-
- float width;
- float height;
-
- CheckboxListener* listener;
- std::string label;
-
-public:
- Checkbox(Vector3f p, std::string label_, CheckboxListener* l);
-
- void draw(DrawingContext& gc);
- bool is_at(int x, int y);
- void on_primary_button_click(int x, int y);
- void set_checkmark(bool check) { is_checked = check; }
-
-private:
- Checkbox();
-}; // Checkbox class
-
-} // GUI namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/checkbox_listener.hpp (from rev 2685,
branches/pingus_sdl/src/gui/checkbox_listener.hxx)
Deleted: branches/pingus_sdl/src/gui/checkbox_listener.hxx
===================================================================
--- branches/pingus_sdl/src/gui/checkbox_listener.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/checkbox_listener.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,38 +0,0 @@
-// $Id: checkbox_listener.hxx,v 1.00 2006/1/15 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2006 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUI_CHECKBOX_LISTENER_HXX
-#define HEADER_PINGUS_GUI_CHECKBOX_LISTENER_HXX
-
-
-namespace GUI {
-
- class Checkbox;
-
-class CheckboxListener {
-public:
- virtual void checkbox_changed(bool new_value, Checkbox* box) = 0;
- virtual ~CheckboxListener() { }
-}; // CheckboxListener class
-
-} // GUI namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/combobox.cpp (from rev 2685,
branches/pingus_sdl/src/gui/combobox.cxx)
Deleted: branches/pingus_sdl/src/gui/combobox.cxx
===================================================================
--- branches/pingus_sdl/src/gui/combobox.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/combobox.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,177 +0,0 @@
-// $Id: combobox.cxx,v 1.16 2005/11/10 21:37:06 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <vector>
-#include <string>
-#include "combobox.hxx"
-#include "combobox_listener.hxx"
-#include "../fonts.hxx"
-
-namespace GUI {
-
-// Constructor
-Combobox::Combobox (Vector3f p, ComboboxListener* listener_, std::string l) :
- current_item(0),
- drop_down(false),
- hover(false),
- pos(p),
- enabled(false),
- label(l),
- listener(listener_)
-{
- // Default to 20 characters wide.
- width = Fonts::smallfont.get_width('O') * 20.0f;
- height = (float)Fonts::smallfont.get_height();
-}
-
-// Destructor
-Combobox::~Combobox ()
-{
- clear();
-}
-
-// Add an item to the combobox
-void
-Combobox::add(ComboItem* item)
-{
- item_list.push_back(item);
-}
-
-// Remove an item from the combobox. Delete it if necessary
-void
-Combobox::remove(ComboItem* item)
-{
- for (std::vector<ComboItem*>::iterator i = item_list.begin();
- i != item_list.end(); i++)
- {
- if ((*i) == item)
- {
- item_list.erase(i);
- if (item->delete_it())
- delete item;
- }
- }
-}
-
-// Remove all items from this combobox
-void
-Combobox::clear()
-{
- for (std::vector<ComboItem*>::iterator i = item_list.begin();
- i != item_list.end(); i++)
- {
- if ((*i)->delete_it())
- delete (*i);
- }
- item_list.clear();
- current_item = 0;
- drop_down = false;
-}
-
-// Returns whether or not the combobox is at this location
-bool
-Combobox::is_at(int x, int y)
-{
- if (enabled)
- return ((float)x > pos.x && (float)x < pos.x + get_width() &&
- (float)y > pos.y && (float)y < pos.y + get_height());
- else
- return false;
-}
-
-// Returns the width of the box
-float
-Combobox::get_width()
-{
- return width;
-}
-
-// Returns the height of the box
-float
-Combobox::get_height()
-{
- if (drop_down)
- return height * ((float)item_list.size() + 1.0f);
- else
- return height;
-}
-
-// action taken when the primary mouse button is clicked
-void
-Combobox::on_primary_button_click(int x, int y)
-{
- if (drop_down)
- {
- // Determine which item was selected, if any, and set the
current item to it.
- drop_down = false;
- if (y > pos.y + height)
- {
- current_item = item_list[static_cast<int>((y - pos.y -
height) / height)];
- listener->combobox_changed(this);
- }
- }
- else
- {
- drop_down = true;
- }
-}
-
-// Draws the Combobox on the screen at it's location
-void
-Combobox::draw(DrawingContext &gc)
-{
- if (!enabled)
- return;
-
- // Draw the label
- gc.print_right(Fonts::smallfont, pos.x, pos.y, label);
-
- // Draw the rectangle
- gc.draw_fillrect(pos.x, pos.y, pos.x + get_width(), pos.y +
get_height(),
- Color(255,255,255));
-
- // Next, draw the rectangle border
- gc.draw_rect(pos.x, pos.y, pos.x + get_width(), pos.y + get_height(),
- Color(0,0,0));
-
- if (drop_down && item_list.size() > 0)
- {
- // Draw the highlighted box
- int y_offset = int(int(((mouse_pos.y - pos.y -
height)/height)+1) * height);
- gc.draw_fillrect(pos.x, pos.y + y_offset, pos.x + get_width(),
pos.y + y_offset +
- height, Color(128,128,128));
-
- // Draw all of the items
- for (unsigned i = 0; i < item_list.size(); i++)
- {
- gc.print_left(Fonts::smallfont, pos.x + 5.0f, pos.y +
((i + 1) * height),
- item_list[i]->get_displayed_string());
- }
- }
-
- if (current_item)
- {
- // Print the currently selected item
- gc.print_left(Fonts::smallfont, pos.x + 3.0f, pos.y,
current_item->get_displayed_string());
- }
-}
-
-} // GUI namespace
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/combobox.hpp (from rev 2685,
branches/pingus_sdl/src/gui/combobox.hxx)
Deleted: branches/pingus_sdl/src/gui/combobox.hxx
===================================================================
--- branches/pingus_sdl/src/gui/combobox.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/combobox.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,184 +0,0 @@
-// $Id: combobox.hxx,v 1.16 2005/11/10 21:37:06 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUI_COMBOBOX_HXX
-#define HEADER_PINGUS_GUI_COMBOBOX_HXX
-
-#include <vector>
-#include <string>
-#include "component.hxx"
-#include "../math/vector3f.hpp"
-
-
-namespace GUI {
-
- class ComboboxListener;
-
-/** A ComboItems holds a specific item in a Combobox (string, id, etc.) */
-class ComboItem
-{
-protected:
- /* The item's hidden ID field */
- std::string id;
-
- /** string that displays when printed on the Combobox */
- std::string str;
-
- /** Should this item be deleted when the Combobox dies? */
- bool delete_item;
-
-public:
- /** Constructors */
- ComboItem () { delete_item = true; }
- ComboItem (std::string id_, std::string displayed_string, bool d =
true)
- : id(id_), str(displayed_string), delete_item(d)
- {
- }
-
- virtual ~ComboItem () { }
-
- /** Returns this item's ID */
- std::string get_id() { return id; }
-
- /** Returns this item's string */
- std::string get_displayed_string() { return str; }
-
- /** Returns the value of del_item */
- bool delete_it() { return delete_item; }
-
- /** Set this item's ID */
- void set_id(std::string s) { id = s; }
-
- /** Set this item's string */
- void set_displayed_string(std::string s) { str = s; }
-
-private:
- ComboItem (const ComboItem&);
- ComboItem& operator= (const ComboItem&);
-}; // ComboItem class
-
-
-
-/** The Combobox class gives you a drop-down list of items to choose from. */
-class Combobox : public Component
-{
-protected:
- /** List of items in this Combobox */
- std::vector<ComboItem*> item_list;
-
- /** The currently selected item in the list */
- ComboItem* current_item;
-
- /** Whether or not the list is showing right now */
- bool drop_down;
-
- /** Is the mouse hovering over this object? */
- bool hover;
-
- /** Where the mouse is located */
- Vector3f mouse_pos;
-
- /** Width of the Combobox */
- float width;
-
- /** Height of EACH ITEM in the Combobox. So, when drop_down is false,
this
- should be the height of the entire widget/component. When
drop_down is
- true, the entire widget's height should be this height times
the number of
- items */
- float height;
-
- /** Location of the Combobox */
- Vector3f pos;
-
- /** Whether or not this combobox is enabled */
- bool enabled;
-
- /** Label that prints to the left of the drop-down */
- std::string label;
-
- /** The "owner" of this combobox */
- ComboboxListener* listener;
-
-public:
- /** Constructor */
- Combobox (Vector3f p, ComboboxListener* listener, std::string label =
std::string());
-
- /** Destructor */
- virtual ~Combobox ();
-
- /** Add an item to the list.
- @param del_item Set to true if you want this Combobox to delete
the
- ComboItem when it's destroyed */
- virtual void add(ComboItem* item);
-
- /** Remove an item from the list */
- virtual void remove(ComboItem* item);
-
- /** Clears all items from combobox */
- virtual void clear();
-
- /** Return a pointer to the selected item. Returns 0 if nothing is
selected */
- ComboItem* get_selected_item() { return current_item; }
-
- /** Sets the selected item to the given ComboItem. Returns false if
that item
- doesn't exist */
- bool set_selected_item(ComboItem*);
-
- /** Draw this Combobox and all of it's items if selected */
- virtual void draw (DrawingContext& gc);
-
- /** Tells the gui_manager if the mouse is on top of the Combobox */
- virtual bool is_at (int x, int y);
-
- /** Returns the height of the Combobox at this given moment. Will be
tall if
- drop_down = true, and short if drop_down = false */
- virtual float get_height();
-
- /** Returns the width of the Combobox */
- virtual float get_width();
-
- /** Gets emmited when a button is pressed and released over the
- same component */
- virtual void on_primary_button_click (int x, int y);
-
- virtual void on_pointer_enter() { hover = true; }
- virtual void on_pointer_leave() { hover = false; }
- virtual void on_pointer_move(int x, int y) { mouse_pos =
Vector3f((float)x, (float)y); }
-
- /** Sets whether or not this combobox is clickable */
- virtual void set_enabled(bool e) { enabled = e; }
-
- /** Returns whether or not the combobox is enabled */
- virtual bool is_enabled() { return enabled; }
-
- /** Sets the label */
- virtual void set_label(std::string l) { label = l; }
-
-private:
- Combobox();
- Combobox (const Combobox&);
- Combobox& operator= (const Combobox&);
-
-}; // Combobox class
-
-} // GUI namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/combobox_listener.hpp (from rev 2685,
branches/pingus_sdl/src/gui/combobox_listener.hxx)
Deleted: branches/pingus_sdl/src/gui/combobox_listener.hxx
===================================================================
--- branches/pingus_sdl/src/gui/combobox_listener.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/combobox_listener.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,38 +0,0 @@
-// $Id: checkbox_listener.hxx,v 1.00 2006/1/17 23:41:12 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2006 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUI_COMBOBOX_LISTENER_HXX
-#define HEADER_PINGUS_GUI_COMBOBOX_LISTENER_HXX
-
-
-namespace GUI {
-
- class Combobox;
-
-class ComboboxListener {
-public:
- virtual void combobox_changed(Combobox* box) = 0;
- virtual ~ComboboxListener() { }
-}; // ComboboxListener class
-
-} // GUI namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/component.hpp (from rev 2685,
branches/pingus_sdl/src/gui/component.hxx)
Deleted: branches/pingus_sdl/src/gui/component.hxx
===================================================================
--- branches/pingus_sdl/src/gui/component.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/component.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,99 +0,0 @@
-// $Id: component.hxx,v 1.16 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUI_COMPONENT_HXX
-#define HEADER_PINGUS_GUI_COMPONENT_HXX
-
-#include "../pingus.hxx"
-
-
-class DrawingContext;
-
-namespace GUI {
-
-/** A component represents an area which recivies events in the GUI,
- some people might call it a widget */
-class Component
-{
-private:
-
-protected:
- bool has_focus;
-
-public:
- Component () : has_focus(false) { }
- virtual ~Component() {}
-
- virtual void set_focus(bool val) { has_focus = val; }
-
- virtual void draw (DrawingContext& gc) =0;
- virtual void update (float delta) { UNUSED_ARG(delta);}
-
- virtual bool is_at (int x, int y) { UNUSED_ARG(x); UNUSED_ARG(y); return
false; }
-
- // Events
- /** Gets issued once the primary button is pressed */
- virtual void on_primary_button_press (int x, int y) { UNUSED_ARG(x);
UNUSED_ARG(y); }
-
- /** Gets issued once the primary button is released */
- virtual void on_primary_button_release (int x, int y) { UNUSED_ARG(x);
UNUSED_ARG(y); }
-
- virtual void on_primary_button_double_click (int x, int y) { UNUSED_ARG(x);
UNUSED_ARG(y); }
-
- virtual void on_secondary_button_press (int x, int y) { UNUSED_ARG(x);
UNUSED_ARG(y); }
- virtual void on_secondary_button_release (int x, int y) { UNUSED_ARG(x);
UNUSED_ARG(y); }
-
- /** Gets emmited when a button is pressed and released over the
- same component */
- virtual void on_primary_button_click (int x, int y) { UNUSED_ARG(x);
UNUSED_ARG(y); }
-
- virtual void on_secondary_button_click (int x, int y) { UNUSED_ARG(x);
UNUSED_ARG(y); }
-
- /** Emmitted when pointer enters the region of the component */
- virtual void on_pointer_enter () {}
-
- /** Emmitted when pointer leaves the region of the component */
- virtual void on_pointer_leave () {}
-
- /** Emitted when the pointer moved, x and y are the new pointer
- coordinates */
- virtual void on_pointer_move (int x, int y) { UNUSED_ARG(x); UNUSED_ARG(y); }
-
- /** Emitted whenever a keyboard character is pressed. Only certain
- components should implement this */
- virtual void on_key_pressed(const char c) { UNUSED_ARG(c); }
-
- // status functions for use in the update() function
- /** return true if currently pressed */
- bool is_pressed ();
-
- /** true if mouse is currently over, FIXME: these seem to be
- unimplementable without renaming on_pointer_enter() and wrapp them */
- bool pointer_over ();
-
-private:
- Component (const Component&);
- Component& operator= (const Component&);
-};
-
-} // namespace GUI
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/cursor.cpp (from rev 2685,
branches/pingus_sdl/src/gui/cursor.cxx)
Deleted: branches/pingus_sdl/src/gui/cursor.cxx
===================================================================
--- branches/pingus_sdl/src/gui/cursor.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/cursor.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,50 +0,0 @@
-// $Id: cursor.cxx,v 1.4 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../input/controller.hxx"
-#include "../input/pointer.hxx"
-#include "../resource.hxx"
-#include "cursor.hxx"
-
-
-Cursor::Cursor(const std::string& ident)
-// : sprite(Resource::load_sprite(ident))
-{
-}
-
-Cursor::~Cursor ()
-{
-}
-
-void
-Cursor::update (float delta)
-{
- sprite.update (delta);
-}
-
-void
-Cursor::on_event()
-{
- ////const Input::Pointer* pointer =
Input::Controller::get_current()->get_pointer();
- // sprite.draw(pointer->get_x_pos (),
- // pointer->get_y_pos ());
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/cursor.hpp (from rev 2685,
branches/pingus_sdl/src/gui/cursor.hxx)
Deleted: branches/pingus_sdl/src/gui/cursor.hxx
===================================================================
--- branches/pingus_sdl/src/gui/cursor.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/cursor.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,50 +0,0 @@
-// $Id: cursor.hxx,v 1.3 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_CURSOR_HXX
-#define HEADER_PINGUS_CURSOR_HXX
-
-#include <string>
-#include "display.hxx"
-#include "../sprite.hpp"
-
-/** A simple mouse cursor class and stupid. We can't use the X11/win32
- nativ mouse cursor because we want also to support non-mouse input
- devices and because we want to support multiple cursors */
-class Cursor : public DisplayHook
-{
-private:
- Sprite sprite;
-
-public:
- Cursor (const std::string& ident);
- virtual ~Cursor ();
-
- virtual void update (float delta);
- virtual void on_event();
-
-private:
- Cursor (const Cursor&);
- Cursor& operator= (const Cursor&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/display.cpp (from rev 2685,
branches/pingus_sdl/src/gui/display.cxx)
Deleted: branches/pingus_sdl/src/gui/display.cxx
===================================================================
--- branches/pingus_sdl/src/gui/display.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/display.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,113 +0,0 @@
-// $Id: display.cxx,v 1.5 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <algorithm>
-#include <stdio.h>
-#include <iostream>
-#include "../globals.hxx"
-#include "display.hxx"
-
-
-std::list<DisplayHook*> Display::display_hooks;
-SDL_Surface* Display::screen;
-
-DisplayHook::DisplayHook() : is_visible(false)
-{
-}
-
-void
-DisplayHook::toggle_display()
-{
- if (is_visible)
- Display::remove_flip_screen_hook(this);
- else
- Display::add_flip_screen_hook(this);
-
- is_visible = !is_visible;
-}
-
-void
-Display::draw_rect(int x1, int y1, int x2, int y2, float r, float g, float b,
float a)
-{
-#if 0
- CL_Display::draw_line(x1, y1, x2, y1, CL_Color(CL_Colorf(r, g, b, a)));
- CL_Display::draw_line(x1, y2, x2, y2, CL_Color(CL_Colorf(r, g, b, a)));
- CL_Display::draw_line(x1, y1, x1, y2, CL_Color(CL_Colorf(r, g, b, a)));
- CL_Display::draw_line(x2, y1, x2, y2, CL_Color(CL_Colorf(r, g, b, a)));
-#endif
-}
-
-void
-Display::flip_display(bool sync)
-{
- for(std::list<DisplayHook*>::iterator i = display_hooks.begin();
- i != display_hooks.end();
- i++)
- {
- (*i)->on_event();
- }
-
- ////CL_Display::flip();
- SDL_Flip(screen);
-}
-
-void
-Display::add_flip_screen_hook(DisplayHook* hook)
-{
- if (std::find(display_hooks.begin(), display_hooks.end(), hook) ==
display_hooks.end())
- display_hooks.push_back(hook);
- else
- std::cout << "Display: Trying to insert a display hook multiple times..."
<< std::endl;
-}
-
-void
-Display::remove_flip_screen_hook(DisplayHook* hook)
-{
- display_hooks.remove(hook);
-}
-
-void
-Display::set_video_mode(int width, int height)
-{
- screen = SDL_SetVideoMode(width, height, 0, SDL_DOUBLEBUF); // |
SDL_FULLSCREEN
- if (screen == NULL) {
- printf("Unable to set video mode: %s\n", SDL_GetError());
- exit(1);
- }
-}
-
-int
-Display::get_width()
-{
- return screen->w;
-}
-
-int
-Display::get_height()
-{
- return screen->h;
-}
-
-void
-Display::clear()
-{
- SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/display.hpp (from rev 2685,
branches/pingus_sdl/src/gui/display.hxx)
Deleted: branches/pingus_sdl/src/gui/display.hxx
===================================================================
--- branches/pingus_sdl/src/gui/display.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/display.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,81 +0,0 @@
-// $Id: display.hxx,v 1.5 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DISPLAY_HXX
-#define HEADER_PINGUS_DISPLAY_HXX
-
-#include "../pingus.hxx"
-#include "SDL.h"
-#include <list>
-
-
-class DisplayHook;
-
-/** A flip display hook can be used to attach an event to a
- flip_screen(). An example usage for this is a software mouse
- cursor or a frame counter */
-class DisplayHook
-{
-protected:
- bool is_visible;
-public:
- DisplayHook();
- virtual ~DisplayHook() {}
- /** Called sortly before a flip_display () */
- virtual void on_event() = 0;
- virtual void toggle_display();
-
-private:
- DisplayHook (const DisplayHook&);
- DisplayHook& operator= (const DisplayHook&);
-};
-
-/** This is a kind of wrapper class around CL_Display, it provides
- ways to set the cursor and hooks for flip_display() */
-class Display
-{
-private:
- static std::list<DisplayHook*> display_hooks;
- static SDL_Surface* screen;
-public:
- static void draw_rect(int x1, int y1, int x2, int y2, float r, float g,
float b, float a);
-
- static void flip_display(bool sync=false);
-
- static void add_flip_screen_hook(DisplayHook*);
- static void remove_flip_screen_hook(DisplayHook*);
-
- static int get_width();
- static int get_height();
-
- static void set_video_mode(int width, int height);
-
- static void clear();
-
- static SDL_Surface* get_screen() { return screen; }
-private:
- Display ();
- Display (const Display&);
- Display& operator= (const Display&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/game_delta.hpp (from rev 2685,
branches/pingus_sdl/src/gui/game_delta.hxx)
Deleted: branches/pingus_sdl/src/gui/game_delta.hxx
===================================================================
--- branches/pingus_sdl/src/gui/game_delta.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/game_delta.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,68 +0,0 @@
-// $Id: game_delta.hxx,v 1.3 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GAME_DELTA_HXX
-#define HEADER_PINGUS_GAME_DELTA_HXX
-
-#include <list>
-#include "../delta_manager.hxx"
-#include "../input/event.hxx"
-
-
-/** Input for the game engine */
-class GameDelta
-{
-private:
- /** time delta since the last update */
- const float time_delta;
-
- const unsigned int absolute_time;
-
- /** Reference to the event list from the controller, we must not
- delete the Event* */
- Input::EventLst events;
-
-public:
- /** Construct a GameDelta with both time and events */
- GameDelta (float time_delta_arg,
- unsigned int absolute_time_arg,
- const Input::EventLst& e)
- : time_delta (time_delta_arg),
- absolute_time (absolute_time_arg),
- events (e) {}
-
- /** Return the time that has passed in seconds since the last update() */
- float get_time () const { return time_delta; }
-
- /** @return the time since the application startup in miliseconds
- (1/1000 second) */
- unsigned int get_absolute_time () const { return absolute_time; }
-
- /** Return the events */
- const Input::EventLst& get_events () const { return events; }
-
-private:
- GameDelta (const GameDelta&);
- GameDelta& operator= (const GameDelta&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/game_delta_recorder.hpp (from rev 2685,
branches/pingus_sdl/src/gui/game_delta_recorder.hxx)
Deleted: branches/pingus_sdl/src/gui/game_delta_recorder.hxx
===================================================================
--- branches/pingus_sdl/src/gui/game_delta_recorder.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/game_delta_recorder.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,36 +0,0 @@
-// $Id: game_delta_recorder.hxx,v 1.3 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GAME_DELTA_RECORDER_HXX
-#define HEADER_PINGUS_GAME_DELTA_RECORDER_HXX
-
-
-class GameDeltaRecorder
-{
-private:
-
-public:
- GameDeltaRecorder ();
- GameDelta* get ();
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/gui_manager.cpp (from rev 2685,
branches/pingus_sdl/src/gui/gui_manager.cxx)
Deleted: branches/pingus_sdl/src/gui/gui_manager.cxx
===================================================================
--- branches/pingus_sdl/src/gui/gui_manager.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/gui_manager.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,308 +0,0 @@
-// $Id: gui_manager.cxx,v 1.22 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <algorithm>
-#include "../debug.hxx"
-#include "../globals.hxx"
-#include "../input/event.hxx"
-#include "game_delta.hxx"
-#include "gui_manager.hxx"
-
-
-using namespace GUI;
-using namespace Input;
-
-GUIManager::GUIManager ()
- : primary_pressed_component (0),
- secondary_pressed_component (0),
- focussed_component(0),
- mouse_over_component (0),
- x_pos (400), y_pos (300)
-{
-}
-
-GUIManager::~GUIManager ()
-{
- for (std::vector<Component*>::iterator i = components_for_delete.begin ();
- i != components_for_delete.end (); ++i)
- {
- delete (*i);
- }
-
- components_for_delete.clear();
-}
-
-void
-GUIManager::draw (DrawingContext& gc)
-{
- for (std::vector<Component*>::iterator i = components.begin ();
- i != components.end (); ++i)
- {
- (*i)->draw (gc);
- }
-}
-
-void
-GUIManager::update (const GameDelta& delta)
-{
- process_input (delta);
-
- for (std::vector<Component*>::iterator i = components.begin ();
- i != components.end (); ++i)
- {
- (*i)->update (delta.get_time ());
- }
-}
-
-void
-GUIManager::process_input (const GameDelta& delta)
-{
- const std::vector<Input::Event>& events = delta.get_events();
-
- for (std::vector<Input::Event>::const_iterator i = events.begin (); i !=
events.end (); ++i)
- {
- switch (i->type)
- {
- case Input::PointerEventType:
- process_pointer_event (i->pointer);
- break;
-
- case Input::ButtonEventType:
- process_button_event (delta.get_absolute_time(), i->button);
- break;
-
- case Input::AxisEventType:
- // AxisEvents can be ignored in the GUI, they are handled elsewhere
- pout (PINGUS_DEBUG_GUI) << "GUIManager: AxisEvent: " << i->axis.dir
<< std::endl;
- break;
-
- case Input::KeyboardEventType:
- process_keyboard_event(i->keyboard);
- break;
-
- default:
- pwarn (PINGUS_DEBUG_GUI) << "GUIManager: unhandled event type " <<
i->type << std::endl;
- break;
- }
- }
-}
-
-void
-GUIManager::add(Component* c, bool delete_component)
-{
- components.push_back(c);
- if( delete_component )
- components_for_delete.push_back(c);
-}
-
-void
-GUIManager::remove(Component* c)
-{
- Components::iterator i = std::find(components.begin(), components.end(), c);
- if (i != components.end())
- components.erase(i);
-}
-
-Component*
-GUIManager::component_at (int x, int y)
-{
- // we travel reversly through the component list, so that we get the
- // top most component at first
- for (std::vector<Component*>::reverse_iterator i = components.rbegin ();
- i != components.rend (); ++i)
- {
- if ((*i)->is_at (x, y))
- return *i;
- }
- return 0;
-}
-
-bool
-GUIManager::is_at (int x, int y)
-{
- for (std::vector<Component*>::iterator i = components.begin ();
- i != components.end (); ++i)
- {
- if ((*i)->is_at (x, y))
- return true;
- }
-
- return false;
-}
-
-void
-GUIManager::process_pointer_event (const Input::PointerEvent& event)
-{
- x_pos = static_cast<int>(event.x);
- y_pos = static_cast<int>(event.y);
-
- Component* comp = component_at(x_pos, y_pos);//FIXME
-
- if (primary_pressed_component)
- primary_pressed_component->on_pointer_move (x_pos, y_pos);
- else if (comp)
- {
- comp->on_pointer_move (x_pos, y_pos);
- }
-
- if (comp)
- {
- if (comp != mouse_over_component)
- {
- if (mouse_over_component != 0)
- mouse_over_component->on_pointer_leave ();
-
- comp->on_pointer_enter ();
- mouse_over_component = comp;
- }
- else
- {
- // nothing changed, so we don't trigger events
- }
- }
- else
- {
- if (mouse_over_component)
- {
- mouse_over_component->on_pointer_leave ();
- mouse_over_component = 0;
- }
- }
-
-}
-
-void
-GUIManager::process_button_event (unsigned int time_stamp, const
Input::ButtonEvent& event)
-{
- //std::cout << "GUIManager: Got button event: " << event.name << " " <<
event.state << std::endl;
-
- Component* comp = component_at (x_pos, y_pos);//FIXME: x/y_pos should be
inside controller
-
- if (comp)
- {
- if (event.name == primary && event.state == Input::pressed)
- {
- primary_pressed_component = comp;
- change_focussed_comp(comp);
- comp->on_primary_button_press (x_pos, y_pos);
-
- // FIXME: add double click detection here
- }
- else if (event.name == primary && event.state == Input::released)
- {
- /** Send the release event to the same component
- which got the press event */
- if (primary_pressed_component)
- {
- primary_pressed_component->on_primary_button_release (x_pos,
y_pos);
-
- if (primary_pressed_component == comp)
- {
- //std::cout << "GUIManager: calling on_primary_button_click
()" << std::endl;
- comp->on_primary_button_click (x_pos, y_pos);
- }
- else
- {
- // discard click
- }
- primary_pressed_component = 0;
- }
- else
- {
- /* FIXME: This happens when you press a button
- FIXME: in one GUIManager and switch in the
- FIXME: on_primary_button_press() method to another
- FIXME: manager, not sure if there is or
- FIXME: should be a workaround */
- if (maintainer_mode)
- std::cout << "GUIManager: Got a release without a press,
possibly a bug" << std::endl;
- }
- }
-
- // Secondary button
- if (event.name == secondary && event.state == Input::pressed)
- {
- secondary_pressed_component = comp;
- change_focussed_comp(comp);
- comp->on_secondary_button_press (x_pos, y_pos);
- }
- else if (event.name == secondary && event.state == Input::released)
- {
- /** Send the release event to the same component
- which got the press event */
- if (secondary_pressed_component)
- {
- secondary_pressed_component->on_secondary_button_release (x_pos,
y_pos);
-
- if (secondary_pressed_component == comp)
- {
- //std::cout << "GUIManager: calling on_secondary_button_click
()" << std::endl;
- comp->on_secondary_button_click (x_pos, y_pos);
- }
- else
- {
- // discard click
- }
- secondary_pressed_component = 0;
- }
- else
- {
- /* FIXME: This happens when you press a button
- FIXME: in one GUIManager and switch in the
- FIXME: on_secondary_button_press() method to another
- FIXME: manager, not sure if there is or
- FIXME: should be a workaround */
- if (maintainer_mode)
- std::cout << "GUIManager: Got a release without a press,
possibly a bug" << std::endl;
- }
- }
-
- }
- else
- {
- if (secondary_pressed_component)
- {
- secondary_pressed_component->on_secondary_button_release (x_pos,
y_pos);
- secondary_pressed_component = 0;
- }
- }
-
- UNUSED_ARG(time_stamp);
-}
-
-void
-GUIManager::process_keyboard_event (const Input::KeyboardEvent &event)
-{
- // Pass key value to last pressed component.
- if (focussed_component)
- focussed_component->on_key_pressed(event.key);
-}
-
-void
-GUIManager::change_focussed_comp(Component* c)
-{
- if (focussed_component)
- focussed_component->set_focus(false);
- focussed_component = c;
- if (focussed_component)
- focussed_component->set_focus(true);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/gui_manager.hpp (from rev 2685,
branches/pingus_sdl/src/gui/gui_manager.hxx)
Deleted: branches/pingus_sdl/src/gui/gui_manager.hxx
===================================================================
--- branches/pingus_sdl/src/gui/gui_manager.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/gui_manager.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,101 +0,0 @@
-// $Id: gui_manager.hxx,v 1.15 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUI_GUI_MANAGER_HXX
-#define HEADER_PINGUS_GUI_GUI_MANAGER_HXX
-
-#include <vector>
-#include "../input/event.hxx"
-#include "component.hxx"
-
-
-class DrawingContext;
-class GameDelta;
-
-namespace GUI {
-
-/** The GUIManager class holds a group of components and manages
- them. It dispatches the GameDelta to each individual
- component
-
- FIXME: We translate GameDelta into another 'language' which is
- then understood by the GUI, this seems unclear, not sure at
- which point it is best to split the GameDelta into
- on_primary_button_press(), etc.
-*/
-class GUIManager : public Component
-{
-private:
- typedef std::vector<Component*> Components;
- Components components;
- Components components_for_delete;
-
- /** The component which recieved the last pressed event */
- Component* primary_pressed_component;
- Component* secondary_pressed_component;
-
- /** Component which currently has the focus (last clicked) */
- Component* focussed_component;
-
- /** The component over which the mouse was in the last update,
- used to detecte enter/leave events */
- Component* mouse_over_component;
-
- // FIXME: Hack: should be handled inside the controller
- int x_pos;
- int y_pos;
-
- void process_input (const GameDelta& delta);
- void process_pointer_event (const Input::PointerEvent& event);
- void process_button_event (unsigned int time_stamp, const
Input::ButtonEvent& event);
- void process_keyboard_event (const Input::KeyboardEvent& event);
-
- /** Change which component has the focus and notify the component */
- void change_focussed_comp(Component* c);
-
-public:
- GUIManager ();
- virtual ~GUIManager ();
-
- virtual void draw (DrawingContext& gc);
- virtual void update (const GameDelta& delta);
- virtual void update (float delta) { UNUSED_ARG (delta); }
-
- /** Add a component to the manager, if delete_component is true
- the component will get deleted on destruction of the manager,
- if false is supplied the user has to handle the component
- itself */
- void add (Component*, bool delete_component);
-
- /** */
- void remove (Component*);
-
- Component* component_at (int x, int y);
- virtual bool is_at (int x, int y);
-
-private:
- GUIManager (const GUIManager&);
- GUIManager& operator= (const GUIManager&);
-};
-
-} // namespace GUI
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/gui_screen.cpp (from rev 2685,
branches/pingus_sdl/src/gui/gui_screen.cxx)
Deleted: branches/pingus_sdl/src/gui/gui_screen.cxx
===================================================================
--- branches/pingus_sdl/src/gui/gui_screen.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/gui_screen.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,167 +0,0 @@
-// $Id: gui_screen.cxx,v 1.5 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../globals.hxx"
-#include "../debug.hxx"
-#include "gui_screen.hxx"
-#include "gui_manager.hxx"
-
-
-GUIScreen::GUIScreen()
- : gui_manager (new GUI::GUIManager())
-{
-}
-
-GUIScreen::~GUIScreen ()
-{
- delete gui_manager;
-}
-
-/** Draw this screen */
-bool
-GUIScreen::draw(DrawingContext& gc)
-{
- draw_background(gc);
- gui_manager->draw(gc);
- draw_foreground(gc);
- return true;
-}
-
- /** Pass a delta to the screen */
-void
-GUIScreen::update (const GameDelta& delta)
-{
- // Dispatch the recieved input events
- gui_manager->update (delta);
-
- update (delta.get_time ());
-
- for (Input::EventLst::const_iterator i = delta.get_events ().begin ();
- i != delta.get_events ().end (); ++i)
- {
- switch (i->type)
- {
- case Input::PointerEventType:
- {
- // ignored cause this is handled in the gui_manager
- }
- break;
-
- case Input::ButtonEventType:
- {
- process_button_event (i->button);
- }
- break;
-
- case Input::AxisEventType:
- {
- if (i->axis.name == Input::action)
- {
- on_action_axis_move (i->axis.dir);
- }
- }
- break;
-
- case Input::ScrollEventType:
- {
-
- }
- break;
-
- case Input::KeyboardEventType:
- {
-
- }
- break;
-
- default:
- std::cout << "GUIScreen::update (): unhandled event type: " <<
i->type << std::endl;
- break;
- }
- }
-}
-
-void
-GUIScreen::process_button_event (const Input::ButtonEvent& event)
-{
- //std::cout << "GUIScreen::process_button_event (Input::ButtonEvent* event)"
<< std::endl;
-
- if (event.state == Input::pressed)
- {
- switch (event.name)
- {
- case Input::primary:
- // ignoring, handled in the gui_manager
- break;
- case Input::secondary:
- // ignoring, handled in the gui_manager
- break;
- case Input::pause:
- on_pause_press ();
- break;
- case Input::fast_forward:
- on_fast_forward_press ();
- break;
- case Input::armageddon:
- on_armageddon_press ();
- break;
- case Input::escape:
- on_escape_press ();
- break;
- default:
- perr(PINGUS_DEBUG_GUI) << "GUIScreen: ButtonEvent: unhandled event: "
<< event.name << std::endl;
- break;
- }
- }
- else if (event.state == Input::released)
- {
- switch (event.name)
- {
- case Input::primary:
- // ignoring, handled in the gui_manager
- break;
- case Input::secondary:
- // ignoring, handled in the gui_manager
- break;
- case Input::pause:
- on_pause_release ();
- break;
- case Input::fast_forward:
- on_fast_forward_release ();
- break;
- case Input::armageddon:
- on_armageddon_release ();
- break;
- case Input::escape:
- on_escape_release ();
- break;
- default:
- perr(PINGUS_DEBUG_GUI) << "GUIScreen: ButtonEvent: unhandled event: "
<< event.name << std::endl;
- break;
- }
- }
- else
- {
- perr(PINGUS_DEBUG_GUI) << "GUIScreen::process_button_event: got unknown
event.state: "
- << event.state << std::endl;;
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/gui_screen.hpp (from rev 2685,
branches/pingus_sdl/src/gui/gui_screen.hxx)
Deleted: branches/pingus_sdl/src/gui/gui_screen.hxx
===================================================================
--- branches/pingus_sdl/src/gui/gui_screen.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/gui_screen.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,76 +0,0 @@
-// $Id: gui_screen.hxx,v 1.3 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUISCREEN_HXX
-#define HEADER_PINGUS_GUISCREEN_HXX
-
-#include "screen.hxx"
-
-
-namespace GUI {
- class GUIManager;
-}
-
-namespace Input {
- struct ButtonEvent;
-}
-
-class GUIScreen : public Screen
-{
-protected:
- GUI::GUIManager* gui_manager;
-
-public:
- GUIScreen ();
- virtual ~GUIScreen ();
-
- /** Draw this screen */
- virtual void draw_foreground (DrawingContext& gc) { UNUSED_ARG(gc); }
- virtual void draw_background (DrawingContext& gc) { UNUSED_ARG(gc); }
- virtual bool draw(DrawingContext& gc);
-
- /** Pass a game delta to the screen */
- virtual void update (const GameDelta& delta);
-
- /** */
- virtual void update (float) {}
-
- virtual void on_pause_press () {}
- virtual void on_fast_forward_press () {}
- virtual void on_armageddon_press () {}
- virtual void on_escape_press () {}
-
- virtual void on_pause_release () {}
- virtual void on_fast_forward_release () {}
- virtual void on_armageddon_release () {}
- virtual void on_escape_release () {}
-
- virtual void on_action_axis_move (float) {}
-
-private:
- void process_button_event (const Input::ButtonEvent& event);
-
- GUIScreen (const GUIScreen&);
- GUIScreen& operator= (const GUIScreen&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/input_box.cpp (from rev 2685,
branches/pingus_sdl/src/gui/input_box.cxx)
Deleted: branches/pingus_sdl/src/gui/input_box.cxx
===================================================================
--- branches/pingus_sdl/src/gui/input_box.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/input_box.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,101 +0,0 @@
-// $Id: input_box.cxx,v 1.16 2006/1/21 21:37:06 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2006 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <algorithm>
-#include "input_box.hxx"
-#include "../display/drawing_context.hxx"
-#include "../math/vector3f.hpp"
-#include "../fonts.hxx"
-
-namespace GUI {
-
-InputBox::InputBox(float width_, Vector3f p, const std::string& default_value,
- bool locked, const std::string& label_)
- : str(default_value),
- pos(p),
- width(width_),
- height((float)Fonts::pingus_small.get_height()),
- is_locked(locked),
- label(label_)
-{
-
-}
-
-void
-InputBox::draw(DrawingContext &gc)
-{
- // Draw the rectangle and border
- gc.draw_fillrect(pos.x, pos.y, pos.x + width, pos.y + height,
- Color(0,0,0));
- gc.draw_rect(pos.x, pos.y, pos.x + width, pos.y + height,
Color(255,255,255));
-
- // If there is text, draw it:
- if (str != std::string())
- gc.print_left(Fonts::pingus_small, pos.x + 10, pos.y,
shrink_string(str));
-
- if (label != std::string())
- gc.print_right(Fonts::pingus_small, pos.x, pos.y, label);
-
- if (has_focus)
- gc.draw_line(pos.x +
Fonts::pingus_small.get_size(shrink_string(str)).width + 12,
- pos.y, pos.x +
Fonts::pingus_small.get_size(shrink_string(str)).width + 12,
- pos.y + height, Color(0,255,255));
-}
-
-bool
-InputBox::is_at(int x, int y)
-{
- return (x > pos.x && x < pos.x + width &&
- y > pos.y && y < pos.y + height);
-}
-
-std::string
-InputBox::shrink_string(const std::string& s) const
-{
- std::string ret_string;
- int w = (int)width / Fonts::pingus_small.get_width('W');
-
- if ((int)s.length() > w - 1)
- ret_string = s.substr(std::max(0, (int)s.length()-w), w - 1);
- else
- ret_string = s;
-
- return ret_string;
-}
-
-void
-InputBox::on_key_pressed(const char c)
-{
- if (!is_locked)
- {
- // Verify input and escape out bad characters
- if (c == 0x08) // backspace
- str = str.substr(0, str.length()-1);
- else if ((c > 0x2c && c < 0x3a) // - . / 0-9
- || (c > 0x40 && c < 0x5b) // capital letters
- || (c > 0x60 && c < 0x7b) // lowercase letters
- || (c == 0x7e || c == 0x5f) // ~ and _
- || c == 0x20) // space
- str += c;
- }
-}
-
-} // GUI
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/input_box.hpp (from rev 2685,
branches/pingus_sdl/src/gui/input_box.hxx)
Deleted: branches/pingus_sdl/src/gui/input_box.hxx
===================================================================
--- branches/pingus_sdl/src/gui/input_box.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/input_box.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,70 +0,0 @@
-// $Id: input_box.hxx,v 1.16 2006/1/21 21:37:06 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2006 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUI_INPUTBOX_HXX
-#define HEADER_PINGUS_GUI_INPUTBOX_HXX
-
-#include "component.hxx"
-#include "../math/vector3f.hpp"
-#include <string>
-
-
- class DrawingContext;
-
-namespace GUI {
-
-/** This class allows keyboard input to be displayed in a box */
-class InputBox : public GUI::Component {
-protected:
- std::string str;
- Vector3f pos;
- float width;
- float height;
- bool is_locked;
-
- /** Shrink the string to fit in the box */
- std::string shrink_string(const std::string& s) const;
-
- /** Optional label to display */
- std::string label;
-
-public:
- InputBox(float width_, Vector3f p, const std::string&
- default_value = std::string(), bool locked = false,
- const std::string& label_ = std::string());
-
- void set_string(const std::string& s) { str = s; }
- std::string get_string() { return str; }
-
- void on_key_pressed(const char c);
-
- /// GUI Component functions:
- ///
- void update(float delta) { }
-
- bool is_at(int x, int y);
-
- void draw(DrawingContext &gc);
-}; // InputBox class
-
-} // GUI namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/input_debug_screen.cpp (from rev 2685,
branches/pingus_sdl/src/gui/input_debug_screen.cxx)
Deleted: branches/pingus_sdl/src/gui/input_debug_screen.cxx
===================================================================
--- branches/pingus_sdl/src/gui/input_debug_screen.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/input_debug_screen.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,101 +0,0 @@
-// $Id: input_debug_screen.cxx,v 1.3 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include <iostream>
-#include "../input/event.hxx"
-//#include "input/scroll_event.hxx"
-#include "input_debug_screen.hxx"
-
-
-using namespace Input;
-
-InputDebugScreen::InputDebugScreen ()
-{
-}
-
-InputDebugScreen::~InputDebugScreen ()
-{
-}
-
-/** Draw this screen */
-bool
-InputDebugScreen::draw (DrawingContext& gc)
-{
- std::cout << "InputDebugScreen::draw ()" << std::endl;
- CL_System::sleep(100);
- UNUSED_ARG(gc);
- return true;
-}
-
-/** Pass a delta to the screen */
-void
-InputDebugScreen::update (const GameDelta& delta)
-{
- std::cout << "InputDebugScreen::update (" << delta.get_time () << ")" <<
std::endl;
- for (Input::EventLst::const_iterator i = delta.get_events ().begin ();
- i != delta.get_events ().end ();
- ++i)
- {
- switch(i->type)
- {
- case ButtonEventType:
- std::cout << "InputDebugScreen: Button event : " << i->type <<
std::endl;
- break;
-
- case PointerEventType:
- std::cout << "InputDebugScreen: Pointer event : " << i->type <<
std::endl;
- break;
-
- case AxisEventType:
- std::cout << "InputDebugScreen: Axis event : " << i->type <<
std::endl;
-
- break;
- case ScrollEventType:
- {
- std::cout << "InputDebugScreen: Scroll event : "
- << i->scroll.x_delta << " " << i->scroll.y_delta <<
std::endl;
- }
- break;
-
- default:
- std::cout << "InputDebugScreen: Unknown event : " << i->type <<
std::endl;
- break;
- }
- }
-}
-
-/** Called once the screen gets activated and becomes the current
- screen */
-void
-InputDebugScreen::on_startup ()
-{
- std::cout << "InputDebugScreen::on_startup ()" << std::endl;
-}
-
-/** Called once the screen gets replaced or poped or shadowed by a
- newly pushed screen */
-void
-InputDebugScreen::on_shutdown ()
-{
- std::cout << "InputDebugScreen::on_shutdown ()" << std::endl;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/input_debug_screen.hpp (from rev 2685,
branches/pingus_sdl/src/gui/input_debug_screen.hxx)
Deleted: branches/pingus_sdl/src/gui/input_debug_screen.hxx
===================================================================
--- branches/pingus_sdl/src/gui/input_debug_screen.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/input_debug_screen.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,52 +0,0 @@
-// $Id: input_debug_screen.hxx,v 1.3 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_DEBUG_SCREEN_HXX
-#define HEADER_PINGUS_INPUT_DEBUG_SCREEN_HXX
-
-#include "screen.hxx"
-
-
-class InputDebugScreen : public Screen
-{
-private:
-
-public:
- InputDebugScreen ();
- virtual ~InputDebugScreen ();
-
- /** Draw this screen */
- bool draw (DrawingContext& gc);
-
- /** Pass a delta to the screen */
- void update (const GameDelta& delta);
-
- /** Called once the screen gets activated and becomes the current
- screen */
- void on_startup ();
-
- /** Called once the screen gets replaced or poped or shadowed by a
- newly pushed screen */
- void on_shutdown ();
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/root_gui_manager.cpp (from rev 2685,
branches/pingus_sdl/src/gui/root_gui_manager.cxx)
Deleted: branches/pingus_sdl/src/gui/root_gui_manager.cxx
===================================================================
--- branches/pingus_sdl/src/gui/root_gui_manager.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/root_gui_manager.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,49 +0,0 @@
-// $Id: root_gui_manager.cxx,v 1.10 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include "root_gui_manager.hxx"
-#include "../input/controller.hxx"
-
-
-using namespace GUI;
-using namespace Input;
-
-RootGUIManager::RootGUIManager (Input::Controller* c)
- : controller(c)
-{
-}
-
-RootGUIManager::~RootGUIManager ()
-{
-}
-
-void
-RootGUIManager::update (float delta)
-{
- assert (!"ERROR RootGUIManager absolete");
- assert (controller);
- //GUIManager::update (delta);
- //process_input (controller->get_events ());
-
- UNUSED_ARG(delta);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/root_gui_manager.hpp (from rev 2685,
branches/pingus_sdl/src/gui/root_gui_manager.hxx)
Deleted: branches/pingus_sdl/src/gui/root_gui_manager.hxx
===================================================================
--- branches/pingus_sdl/src/gui/root_gui_manager.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/root_gui_manager.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,54 +0,0 @@
-// $Id: root_gui_manager.hxx,v 1.7 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUI_ROOT_GUI_MANAGER_HXX
-#define HEADER_PINGUS_GUI_ROOT_GUI_MANAGER_HXX
-
-#include "gui_manager.hxx"
-
-
-namespace Input {
-class Controller;
-}
-
-namespace GUI {
-
-/** Root GUI manager
- */
-class RootGUIManager : public GUIManager
-{
-private:
- Input::Controller* controller;
-
-public:
- RootGUIManager (Input::Controller* c);
- ~RootGUIManager ();
-
- void update (float delta);
-
-private:
- RootGUIManager (const RootGUIManager&);
- RootGUIManager& operator= (const RootGUIManager&);
-};
-}
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/screen.cpp (from rev 2685,
branches/pingus_sdl/src/gui/screen.cxx)
Deleted: branches/pingus_sdl/src/gui/screen.cxx
===================================================================
--- branches/pingus_sdl/src/gui/screen.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/screen.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,22 +0,0 @@
-// $Id: screen.cxx,v 1.1 2003/02/19 09:51:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "screen.hxx"
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/screen.hpp (from rev 2685,
branches/pingus_sdl/src/gui/screen.hxx)
Deleted: branches/pingus_sdl/src/gui/screen.hxx
===================================================================
--- branches/pingus_sdl/src/gui/screen.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/screen.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,64 +0,0 @@
-// $Id: screen.hxx,v 1.4 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SCREEN_HXX
-#define HEADER_PINGUS_SCREEN_HXX
-
-#include "SDL.h"
-#include "game_delta.hxx"
-
-class DrawingContext;
-
-/** A interface for screens. A screen is a Pingus 'thing' which gets
- complete controll over the display and input. Examples of
- screens are the PingusMenu or a PingusGameSession */
-class Screen
-{
-private:
-
-public:
- Screen () { }
- virtual ~Screen () {}
-
- /** Draw this screen @return true if draw was successfull, false if
- frameskip has taken place ('causes a skip of flip_display) */
- virtual bool draw(DrawingContext& gc) =0;
-
- /** Pass a delta to the screen */
- virtual void update (const GameDelta& delta) =0;
-
- virtual unsigned int time_till_next_update() { return 0; }
-
- /** Called once the screen gets activated and becomes the current
- screen */
- virtual void on_startup () {}
-
- /** Called once the screen gets replaced or poped or shadowed by a
- newly pushed screen */
- virtual void on_shutdown () {}
-
-private:
- Screen (const Screen&);
- Screen& operator= (const Screen&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/screen_manager.cpp (from rev 2685,
branches/pingus_sdl/src/gui/screen_manager.cxx)
Deleted: branches/pingus_sdl/src/gui/screen_manager.cxx
===================================================================
--- branches/pingus_sdl/src/gui/screen_manager.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/screen_manager.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,287 +0,0 @@
-// $Id: screen_manager.cxx,v 1.12 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "SDL.h"
-#include <iostream>
-#include "../globals.hxx"
-#include "cursor.hxx"
-#include "display.hxx"
-#include "screen_manager.hxx"
-#include "../path_manager.hxx"
-#include "../display/drawing_context.hxx"
-#include "../input/controller.hxx"
-
-
-ScreenManager* ScreenManager::instance_ = 0;
-
-ScreenManager::ScreenManager()
-{
- display_gc = new DrawingContext();
-
- cached_action = CA_NONE;
-}
-
-ScreenManager::~ScreenManager ()
-{
- delete display_gc;
-}
-
-void
-ScreenManager::display()
-{
- Input::Controller* input_controller = 0;
-
- if (controller_file.empty())
- input_controller = new
Input::Controller(path_manager.complete("controller/default.xml"));
- else
- input_controller = new Input::Controller(controller_file);
- Input::Controller::set_current(input_controller);
-
- Cursor* cursor = 0;
- if (swcursor_enabled)
- {
- cursor = new Cursor("core/cursors/animcross");
- Display::add_flip_screen_hook(cursor);
- //CL_MouseCursor::hide();
- }
-
- DeltaManager delta_manager;
-
- // Main loop for the menu
- while (!screens.empty())
- {
- float time_delta = delta_manager.getset ();
-
- if (time_delta > 1.0)
- {
- if (maintainer_mode)
- std::cout << "ScreenManager: detected large delta (" << time_delta
- << "), ignoring and doing frameskip" << std::endl;
- continue;
- }
-
- // Get new events from ClanLib
- input_controller->update(time_delta);
-
- // Fill the delta with values
- GameDelta delta(time_delta, delta_manager.get_absolute(),
- input_controller->get_events());
- input_controller->clear();
-
- last_screen = get_current_screen();
-
- // Most likly the screen will get changed in this update call
- get_current_screen()->update (delta);
-
- if (cursor)
- cursor->update(time_delta);
-
- // Last screen has poped, so we are going to end here
- if (screens.empty())
- continue;
-
- while (cached_action != CA_NONE)
- {
- switch (cached_action)
- {
- case CA_POP:
- real_pop_screen ();
- break;
- case CA_REPLACE:
- real_replace_screen (replace_screen_arg);
- break;
- case CA_CLEAR:
- real_clear();
- break;
- default:
- break;
- }
- }
-
- // FIXME: is there a more gentel way to do that instead of spreading the
checks all around here?
- // Last screen has poped, so we are going to end here
- if (screens.empty())
- continue;
-
- // skip draw if the screen changed to avoid glitches
- if (last_screen == get_current_screen())
- {
- if (get_current_screen()->draw(*display_gc))
- {
- display_gc->render(Display::get_screen());
- Display::flip_display ();
- display_gc->clear();
- }
- }
- else
- {
- //std::cout << "ScreenManager: fading screens" << std::endl;
- fade_over(last_screen, get_current_screen());
- }
-
- // Stupid hack to make this thing take less CPU
- SDL_Delay(10);
- }
-
- Display::remove_flip_screen_hook(cursor);
- delete cursor;
- delete input_controller;
-}
-
-ScreenPtr&
-ScreenManager::get_current_screen()
-{
- assert(!screens.empty());
- return screens.back ();
-}
-
-ScreenManager*
-ScreenManager::instance ()
-{
- if (instance_)
- return instance_;
- else
- return instance_ = new ScreenManager ();
-}
-
-void
-ScreenManager::push_screen (Screen* screen, bool delete_screen)
-{
- if (!screens.empty())
- {
- screens.back ()->on_shutdown ();
- }
-
- screens.push_back (ScreenPtr(screen, delete_screen));
- screen->on_startup ();
-}
-
-void
-ScreenManager::pop_screen ()
-{
- assert (cached_action == CA_NONE);
- cached_action = CA_POP;
-}
-
-void
-ScreenManager::replace_screen (Screen* screen, bool delete_screen)
-{
- assert (cached_action == CA_NONE);
- cached_action = CA_REPLACE;
- replace_screen_arg = ScreenPtr(screen, delete_screen);
-}
-
-void
-ScreenManager::real_replace_screen (const ScreenPtr& ptr)
-{
- cached_action = CA_NONE;
- screens.back ()->on_shutdown ();
- screens.back () = ptr;
- screens.back ()->on_startup ();
-}
-
-void
-ScreenManager::real_pop_screen ()
-{
- cached_action = CA_NONE;
- ScreenPtr back = screens.back ();
- screens.pop_back();
- back->on_shutdown();
-
- if (!screens.empty ())
- {
- screens.back ()->on_startup ();
- }
-}
-
-void
-ScreenManager::clear()
-{
- cached_action = CA_CLEAR;
-}
-
-void
-ScreenManager::real_clear()
-{
- cached_action = CA_NONE;
- screens.clear();
-}
-
-void
-ScreenManager::fade_over (ScreenPtr& old_screen, ScreenPtr& new_screen)
-{
- // FIXME: This entire function doesn't work very well.
-#if 0
- if (0)
- {
- DeltaManager delta_manager;
- float passed_time = 0;
-
- //Input::EventLst events;
-
- int screen_width = CL_Display::get_width ();
- int screen_height = CL_Display::get_height ();
- float progress = 0.0f;
- while (progress <= 1.0f)
- {
- float time_delta = delta_manager.getset ();
- passed_time += time_delta;
-
- int border_x = int((screen_width/2) * (1.0f - progress));
- int border_y = int((screen_height/2) * (1.0f - progress));
-
- old_screen->draw(*display_gc);
- CL_Display::get_current_window()->get_gc()
- ->push_cliprect(CL_Rect(0 + border_x,
- 0 + border_y,
- screen_width - border_x,
- screen_height - border_y));
- new_screen->draw(*display_gc);
-
- //GameDelta delta (time_delta, CL_System::get_time(), events);
- // FIXME: Animation looks nifty but doesn't work all that good
- //new_screen->update (delta);
- //old_screen->update (delta);
-
- CL_Display::get_current_window()->get_gc()->pop_cliprect ();
-
- Display::flip_display ();
- CL_System::keep_alive (5);
-
- progress = passed_time/1.0f;
- }
- }
-#endif
-}
-
-void
-ScreenManager::init()
-{
- instance_ = 0;
-}
-
-void
-ScreenManager::deinit()
-{
- delete instance_;
- instance_ = 0;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/screen_manager.hpp (from rev 2685,
branches/pingus_sdl/src/gui/screen_manager.hxx)
Deleted: branches/pingus_sdl/src/gui/screen_manager.hxx
===================================================================
--- branches/pingus_sdl/src/gui/screen_manager.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/screen_manager.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,98 +0,0 @@
-// $Id: screen_manager.hxx,v 1.7 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SCREEN_MANAGER_HXX
-#define HEADER_PINGUS_SCREEN_MANAGER_HXX
-
-#include "../pingus.hxx"
-#include <vector>
-
-#include "screen_ptr.hxx"
-
-
-class DrawingContext;
-class Screen;
-
-class ScreenManager
-{
-private:
- static ScreenManager* instance_;
-
- SDL_Surface* screen;
- DrawingContext* display_gc;
-
- /** Screen stack (first is the screen, second is delete_screen,
- which tells if the screen should be deleted onces it got poped
- or replaced) */
- std::vector<ScreenPtr> screens;
-
- /** the screen that was used in the last update() */
- ScreenPtr last_screen;
-
- enum { CA_NONE, CA_POP, CA_REPLACE, CA_CLEAR } cached_action;
- ScreenPtr replace_screen_arg;
-
-protected:
- ScreenManager ();
-public:
- ~ScreenManager();
-
- /** Start the screen manager and let it take control, this will
- not return until the somebody signals a quit() */
- void display ();
-
- /** Replace the current screen */
- void replace_screen (Screen*, bool delete_screen = false);
-
- /** Add a screen on top of another screen */
- void push_screen (Screen*, bool delete_screen = false);
-
- /** Remove the current screen and fall back to the last one */
- void pop_screen ();
-
- /** Remove all screens from the stack */
- void clear();
-private:
- void real_clear();
-
- /** Replace the current screen */
- void real_replace_screen (const ScreenPtr&);
-
- /** Remove the current screen and fall back to the last one */
- void real_pop_screen ();
-
- /** FadeOver test*/
- void fade_over (ScreenPtr& old_screen, ScreenPtr& new_screen);
-
- /** @return a pointer to the current Screen */
- ScreenPtr& get_current_screen();
-
-public:
- static ScreenManager* instance ();
- static void init();
- static void deinit();
-private:
- ScreenManager (const ScreenManager&);
- ScreenManager& operator= (const ScreenManager&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/screen_manager_impl.hpp (from rev 2685,
branches/pingus_sdl/src/gui/screen_manager_impl.hxx)
Deleted: branches/pingus_sdl/src/gui/screen_manager_impl.hxx
===================================================================
--- branches/pingus_sdl/src/gui/screen_manager_impl.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/screen_manager_impl.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,44 +0,0 @@
-// $Id: screen_manager_impl.hxx,v 1.3 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SCREEN_MANAGER_IMPL_HXX
-#define HEADER_PINGUS_SCREEN_MANAGER_IMPL_HXX
-
-#include "pingus.hxx"
-
-
-class ScreenManagerImpl
-{
-private:
- typedef enum { PINGUSMAIN_MENU } States;
-public:
- ScreenManagerImpl ();
- ~ScreenManagerImpl ();
-
- void display ();
-
-private:
- ScreenManagerImpl (const ScreenManagerImpl&);
- ScreenManagerImpl& operator= (const ScreenManagerImpl&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/screen_ptr.cpp (from rev 2685,
branches/pingus_sdl/src/gui/screen_ptr.cxx)
Deleted: branches/pingus_sdl/src/gui/screen_ptr.cxx
===================================================================
--- branches/pingus_sdl/src/gui/screen_ptr.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/screen_ptr.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,59 +0,0 @@
-// $Id: screen_ptr.cxx,v 1.4 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <typeinfo>
-#include <iostream>
-#include "screen_ptr.hxx"
-
-
-void
-ScreenPtr::decrease_refcount()
-{
- //std::cout << "ScreenPtr::decrease_refcount(): " << screen << std::endl;
-
- if (delete_it)
- {
- //std::cout << "*ref_count: " << *ref_count << std::endl;
-
- *ref_count -= 1;
-
- if (*ref_count == 0)
- {
- //std::cout << "XXXXXXXXXXXXXX ScreenPtr: deleting: "
- //<< screen << " = " << typeid(*screen).name() << std::endl;
- delete screen;
- delete ref_count;
- }
- }
-}
-
-void
-ScreenPtr::increase_refcount()
-{
- //std::cout << "ScreenPtr::increase_refcount(): " << screen << std::endl;
-
- if (delete_it)
- {
- //std::cout << "*ref_count: " << *ref_count << std::endl;
- *ref_count += 1;
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/screen_ptr.hpp (from rev 2685,
branches/pingus_sdl/src/gui/screen_ptr.hxx)
Deleted: branches/pingus_sdl/src/gui/screen_ptr.hxx
===================================================================
--- branches/pingus_sdl/src/gui/screen_ptr.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/gui/screen_ptr.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,110 +0,0 @@
-// $Id: screen_ptr.hxx,v 1.3 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SCREEN_PTR_HXX
-#define HEADER_PINGUS_SCREEN_PTR_HXX
-
-#include "screen.hxx"
-
-
-/** The ScreenPtr is a simple smart pointer to point at a Screen. It
- either deletes the pointer or not, depending on the value of
- delete_it */
-class ScreenPtr
-{
-private:
- Screen* screen;
- bool delete_it;
- long* ref_count;
-
-public:
- ScreenPtr()
- : screen(0), delete_it(false), ref_count(0)
- {
- }
-
- ScreenPtr(Screen* arg_screen, bool arg_delete_it)
- : screen(arg_screen), delete_it(arg_delete_it)
- {
- if (delete_it)
- {
- ref_count = new long;
- *ref_count = 1;
- }
- else
- {
- ref_count = 0;
- }
- }
-
- ScreenPtr (const ScreenPtr& ptr)
- : screen(ptr.screen), delete_it(ptr.delete_it), ref_count(ptr.ref_count)
- {
- increase_refcount();
- }
-
- bool operator==(const ScreenPtr& ptr)
- {
- return screen == ptr.screen;
- }
-
- ScreenPtr& operator= (const ScreenPtr& ptr)
- {
- if (this != &ptr)
- {
- decrease_refcount();
-
- screen = ptr.screen;
- delete_it = ptr.delete_it;
- ref_count = ptr.ref_count;
-
- increase_refcount();
- }
- return *this;
- }
-
- ~ScreenPtr()
- {
- decrease_refcount();
- }
-
- Screen* operator->()
- {
- return screen;
- }
-
- const Screen& operator*()
- {
- return *screen;
- }
-
- Screen* get()
- {
- return screen;
- }
-
-private:
- void decrease_refcount();
- void increase_refcount();
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/surface_button.cpp (from rev 2685,
branches/pingus_sdl/src/gui/surface_button.cxx)
Deleted: branches/pingus_sdl/src/gui/surface_button.cxx
===================================================================
--- branches/pingus_sdl/src/gui/surface_button.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/surface_button.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,105 +0,0 @@
-// $Id: surface_button.cxx,v 1.10 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../resource.hxx"
-#include "../math/vector3f.hpp"
-#include "../display/drawing_context.hxx"
-#include "surface_button.hxx"
-
-
-namespace GUI {
-
-SurfaceButton::SurfaceButton (int arg_x_pos, int arg_y_pos,
- const ResDescriptor& arg_button_surface,
- const ResDescriptor& arg_button_pressed_surface,
- const ResDescriptor&
arg_button_mouse_over_surface)
- : x_pos (arg_x_pos), y_pos (arg_y_pos), pressed (false), mouse_over (false)
-{
- button_surface = Resource::load_sprite(arg_button_surface);
- button_pressed_surface =
Resource::load_sprite(arg_button_pressed_surface);
- button_mouse_over_surface =
Resource::load_sprite(arg_button_mouse_over_surface);
-}
-
-SurfaceButton::~SurfaceButton ()
-{
-}
-
-void
-SurfaceButton::draw (DrawingContext& gc)
-{
- if (pressed && mouse_over)
- gc.draw(button_pressed_surface, Vector3f((float)x_pos, (float)y_pos));
- else if (!pressed && mouse_over)
- gc.draw(button_mouse_over_surface, Vector3f((float)x_pos, (float)y_pos));
- else
- gc.draw(button_surface, Vector3f((float)x_pos, (float)y_pos));
-}
-
-bool
-SurfaceButton::is_at (int x, int y)
-{
- /*std::cout << "Is AT: " << (x > x_pos && x < x_pos +
int(button_surface.get_width ())
- && y > y_pos && y < y_pos +
int(button_surface.get_height ()))
- << std::endl;*/
-
- return x > x_pos && x < x_pos + int(button_surface.get_width ())
- && y > y_pos && y < y_pos + int(button_surface.get_height ());
-}
-
-void
-SurfaceButton::on_primary_button_press (int x, int y)
-{
- pressed = true;
-
- UNUSED_ARG(x);
- UNUSED_ARG(y);
-}
-
-void
-SurfaceButton::on_primary_button_release (int x, int y)
-{
- pressed = false;
-
- UNUSED_ARG(x);
- UNUSED_ARG(y);
-}
-
-void
-SurfaceButton::on_pointer_enter ()
-{
- mouse_over = true;
-}
-
-void
-SurfaceButton::on_pointer_leave ()
-{
- mouse_over = false;
-}
-
-void
-SurfaceButton::on_primary_button_click (int x, int y)
-{
- on_click();
- UNUSED_ARG(x);
- UNUSED_ARG(y);
-}
-
-} // namespace GUI
-
-/* EOF */
Copied: branches/pingus_sdl/src/gui/surface_button.hpp (from rev 2685,
branches/pingus_sdl/src/gui/surface_button.hxx)
Deleted: branches/pingus_sdl/src/gui/surface_button.hxx
===================================================================
--- branches/pingus_sdl/src/gui/surface_button.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/gui/surface_button.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,71 +0,0 @@
-// $Id: surface_button.hxx,v 1.11 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUI_SURFACE_BUTTON_HXX
-#define HEADER_PINGUS_GUI_SURFACE_BUTTON_HXX
-
-#include "../sprite.hpp"
-#include "component.hxx"
-
-class ResDescriptor;
-
-namespace GUI {
-
-/** A simple surface button, which different surfaces for pressed,
- released and mouse over */
-class SurfaceButton : public Component
-{
-protected:
- int x_pos;
- int y_pos;
-
- Sprite button_surface;
- Sprite button_pressed_surface;
- Sprite button_mouse_over_surface;
-
- bool pressed;
- bool mouse_over;
-public:
- SurfaceButton (int x_pos, int y_pos,
- const ResDescriptor& button_surface,
- const ResDescriptor& button_pressed_surface,
- const ResDescriptor& button_mouse_over_surface);
- virtual ~SurfaceButton ();
-
- virtual void draw (DrawingContext& gc);
- bool is_at (int x, int y);
-
- void on_primary_button_press (int x, int y);
- void on_primary_button_release (int x, int y);
- void on_primary_button_click (int x, int y);
-
- virtual void on_pointer_enter ();
- virtual void on_pointer_leave ();
-
- virtual void on_click() {}
-private:
- SurfaceButton (const SurfaceButton&);
- SurfaceButton& operator= (const SurfaceButton&);
-};
-
-} // namespace GUI
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/indexed_canvas.cpp (from rev 2685,
branches/pingus_sdl/src/indexed_canvas.cxx)
Deleted: branches/pingus_sdl/src/indexed_canvas.cxx
===================================================================
--- branches/pingus_sdl/src/indexed_canvas.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/indexed_canvas.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,51 +0,0 @@
-// $Id: indexed_canvas.cxx,v 1.3 2002/10/20 18:28:48 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "indexed_canvas.hxx"
-#include <assert.h>
-
-
-IndexedCanvas::IndexedCanvas(int w, int h)
- : width(w),
- height(h),
- transcol(-1)
-{
- data = new unsigned char [width * height];
-}
-
-IndexedCanvas::~IndexedCanvas()
-{
- delete[] data;
-}
-
-void
-IndexedCanvas::set_palette(CL_Palette* p)
-{
- assert(p);
- memcpy(palette.palette, p->palette, p->num_colors*3);
-}
-
-CL_Palette*
-IndexedCanvas::get_palette() const
-{
- return const_cast<CL_Palette*>(&palette);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/indexed_canvas.hpp (from rev 2685,
branches/pingus_sdl/src/indexed_canvas.hxx)
Deleted: branches/pingus_sdl/src/indexed_canvas.hxx
===================================================================
--- branches/pingus_sdl/src/indexed_canvas.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/indexed_canvas.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,74 +0,0 @@
-// $Id: indexed_canvas.hxx,v 1.6 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INDEXED_CANVAS_HXX
-#define HEADER_PINGUS_INDEXED_CANVAS_HXX
-
-#include <ClanLib/Display/pixel_buffer.h>
-#include <ClanLib/Display/palette.h>
-
-
-/** This class is analog to CL_Canvas, but instead of being true
- color, it is indexed */
-class IndexedCanvas : public PixelBuffer
-{
-private:
- unsigned int width;
- unsigned int height;
- int transcol;
- unsigned char* data;
- CL_Palette palette;
-public:
- IndexedCanvas(int width, int height);
- ~IndexedCanvas();
-
- bool is_indexed() const { return true; }
- unsigned int get_width() const { return width; }
- unsigned int get_pitch() const { return width; }
- unsigned int get_height() const { return height; }
-
- unsigned int get_num_frames() const { return 1; }
- void* get_data() const { return data; }
- void set_palette(CL_Palette*);
- CL_Palette* get_palette() const;
-
- void lock() {}
- void unlock() {}
-
- unsigned int get_bytes_per_pixel () const { return 1; }
- unsigned int get_depth() const { return 8; }
-
- bool uses_src_colorkey() const { return transcol != -1; }
- unsigned int get_src_colorkey() const { return transcol; }
- void set_src_colorkey(int t) { transcol = t; }
-
- unsigned int get_red_mask() const { return 0; }
- unsigned int get_green_mask() const { return 0; }
- unsigned int get_blue_mask() const { return 0; }
- unsigned int get_alpha_mask() const { return 0; }
-
-private:
- IndexedCanvas (const IndexedCanvas&);
- IndexedCanvas& operator= (const IndexedCanvas&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axes/button_axis.cpp (from rev 2685,
branches/pingus_sdl/src/input/axes/button_axis.cxx)
Deleted: branches/pingus_sdl/src/input/axes/button_axis.cxx
===================================================================
--- branches/pingus_sdl/src/input/axes/button_axis.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/axes/button_axis.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,79 +0,0 @@
-// $Id: button_axis.cxx,v 1.7 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "button_axis.hxx"
-#include "../button.hxx"
-
-namespace Input {
-namespace Axes {
-
-ButtonAxis::ButtonAxis (float angle_, Button* button1_, Button* button2_) :
- pos(0), angle(angle_), button1(button1_), button2(button2_)
-{
- if (angle < 0)
- angle = static_cast<float>((static_cast<int>(angle) % 360) + 360);
- else if (angle > 360)
- angle = static_cast<float>((static_cast<int>(angle) % 360) + 0);
-}
-
-ButtonAxis::~ButtonAxis ()
-{
- delete button1;
- delete button2;
-}
-
-const float&
-ButtonAxis::get_pos () const
-{
- return pos;
-}
-
-const float&
-ButtonAxis::get_angle () const
-{
- return angle;
-}
-
-void
-ButtonAxis::update (float delta)
-{
- button1->update(delta);
- button2->update(delta);
-
- if (button1->is_pressed() == button2->is_pressed())
- {
- pos = 0;
- return;
- }
-
- if (button1->is_pressed() && pos > -1.0f)
- pos -= delta;
- else if (pos < 1.0f)
- pos += delta;
-
- if (pos < -1.0f)
- pos = -1.0f;
- else if (pos > 1.0f)
- pos = 1.0f;
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axes/button_axis.hpp (from rev 2685,
branches/pingus_sdl/src/input/axes/button_axis.hxx)
Deleted: branches/pingus_sdl/src/input/axes/button_axis.hxx
===================================================================
--- branches/pingus_sdl/src/input/axes/button_axis.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/axes/button_axis.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,65 +0,0 @@
-// $Id: button_axis.hxx,v 1.6 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_BUTTON_AXIS_HXX
-#define HEADER_PINGUS_INPUT_BUTTON_AXIS_HXX
-
-#include "../axis.hxx"
-
-namespace Input {
-
-class Button;
-
-namespace Axes {
-
-/**
- @brief maps two buttons into an axis
-
- XML definition: <button-axis angle=?> <some button 1><some button 2>
</button-axis>
-*/
-class ButtonAxis : public Axis {
-
-private:
- float pos;
- float angle;
-
- Button* const button1;
- Button* const button2;
-
-public:
-
- ButtonAxis (float angle_, Button* button1_, Button* button2_);
- ~ButtonAxis ();
-
- virtual const float& get_pos () const;
- virtual const float& get_angle () const;
-
- virtual void update (float delta);
-
-private:
- ButtonAxis (const ButtonAxis&);
- ButtonAxis& operator= (const ButtonAxis&);
-};
-
-} // namespace Axes
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axes/dummy_axis.hpp (from rev 2685,
branches/pingus_sdl/src/input/axes/dummy_axis.hxx)
Deleted: branches/pingus_sdl/src/input/axes/dummy_axis.hxx
===================================================================
--- branches/pingus_sdl/src/input/axes/dummy_axis.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/axes/dummy_axis.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,58 +0,0 @@
-// $Id: dummy_axis.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_DUMMY_AXIS_HXX
-#define HEADER_PINGUS_INPUT_DUMMY_AXIS_HXX
-
-#include "../axis.hxx"
-
-namespace Input {
-namespace Axes {
-
-/**
- @brief Dummy Axis to be used if an axis is required but none defined
-
- XML definition: none
-*/
-class DummyAxis : public Axis {
-
-private:
- float pos;
- float angle;
-
-public:
-
- DummyAxis () : pos(0.0f), angle(0.0f) { }
-
- virtual const float& get_pos () const { return pos; }
- virtual const float& get_angle () const { return angle; }
-
- virtual void update(float) { }
-
-private:
- DummyAxis (const DummyAxis&);
- DummyAxis& operator= (const DummyAxis&);
-};
-
-} // namespace Axis
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axes/inverted_axis.cpp (from rev 2685,
branches/pingus_sdl/src/input/axes/inverted_axis.cxx)
Deleted: branches/pingus_sdl/src/input/axes/inverted_axis.cxx
===================================================================
--- branches/pingus_sdl/src/input/axes/inverted_axis.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/axes/inverted_axis.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,56 +0,0 @@
-// $Id: inverted_axis.cxx,v 1.4 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "inverted_axis.hxx"
-
-namespace Input {
-namespace Axes {
-
-InvertedAxis::InvertedAxis (Axis* axis_) : axis(axis_)
-{
- angle = static_cast<float>((static_cast<int>(axis->get_angle()) + 180) %
360);
-}
-
-InvertedAxis::~InvertedAxis ()
-{
- delete axis;
-}
-
-const float&
-InvertedAxis::get_pos () const
-{
- return axis->get_pos();
-}
-
-const float&
-InvertedAxis::get_angle () const
-{
- return angle;
-}
-
-void
-InvertedAxis::update (float delta)
-{
- axis->update(delta);
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axes/inverted_axis.hpp (from rev 2685,
branches/pingus_sdl/src/input/axes/inverted_axis.hxx)
Deleted: branches/pingus_sdl/src/input/axes/inverted_axis.hxx
===================================================================
--- branches/pingus_sdl/src/input/axes/inverted_axis.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/axes/inverted_axis.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,58 +0,0 @@
-// $Id: inverted_axis.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_INVERTED_AXIS_HXX
-#define HEADER_PINGUS_INPUT_INVERTED_AXIS_HXX
-
-#include "../axis.hxx"
-
-namespace Input {
-namespace Axes {
-
-/**
- @brief decorator class inverting the angle of an axis
-
- XML definition: <inverted-axis> <axis> </inverted-axis>
-*/
-class InvertedAxis : public Axis {
-
-private:
- Axis* const axis;
- float angle;
-
-public:
- InvertedAxis (Axis* axis_);
- ~InvertedAxis ();
-
- virtual const float& get_pos () const;
- virtual const float& get_angle () const;
-
- virtual void update (float delta);
-
-private:
- InvertedAxis (const InvertedAxis&);
- InvertedAxis& operator= (const InvertedAxis&);
-};
-
-} // namespace Axes
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axes/joystick_axis.cpp (from rev 2685,
branches/pingus_sdl/src/input/axes/joystick_axis.cxx)
Deleted: branches/pingus_sdl/src/input/axes/joystick_axis.cxx
===================================================================
--- branches/pingus_sdl/src/input/axes/joystick_axis.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/axes/joystick_axis.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,66 +0,0 @@
-// $Id: joystick_axis.cxx,v 1.6 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-//#include <ClanLib/Display/input.h>
-#include <ClanLib/Display/input_device.h>
-#include <ClanLib/Display/joystick.h>
-//#include <ClanLib/Display/inputaxis.h>
-#include "joystick_axis.hxx"
-#include "../../pingus_error.hxx"
-
-namespace Input {
-namespace Axes {
-
-JoystickAxis::JoystickAxis(int id_, int axis_, float angle_)
- : id(id_), axis(axis_), pos(0), angle(angle_)
-{
- if (id >= CL_Joystick::get_device_count())
- PingusError::raise("JoystickAxis: Invalid joystick id");
-
- if (axis > CL_Joystick::get_device(id).get_axis_count())
- PingusError::raise("JoystickAxis: Invalid joystick axis id");
-
- if (angle < 0)
- angle = float(static_cast<int>(angle) % 360) + 360;
- else if (angle > 360)
- angle = float(static_cast<int>(angle) % 360);
-}
-
-const float&
-JoystickAxis::get_pos () const
-{
- return pos;
-}
-
-const float&
-JoystickAxis::get_angle () const
-{
- return angle;
-}
-
-void
-JoystickAxis::update (float)
-{
- pos = CL_Joystick::get_device(id).get_axis(axis);
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axes/joystick_axis.hpp (from rev 2685,
branches/pingus_sdl/src/input/axes/joystick_axis.hxx)
Deleted: branches/pingus_sdl/src/input/axes/joystick_axis.hxx
===================================================================
--- branches/pingus_sdl/src/input/axes/joystick_axis.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/axes/joystick_axis.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,60 +0,0 @@
-// $Id: joystick_axis.hxx,v 1.5 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_JOYSTICK_AXIS_HXX
-#define HEADER_PINGUS_INPUT_JOYSTICK_AXIS_HXX
-
-#include "../axis.hxx"
-
-namespace Input {
-namespace Axes {
-
- /**
- @brief represents an axis of a joystick
-
- XML definition: <joystick-axis angle="?" id="joystick id" axis="axis of
the joystick"/>
- */
- class JoystickAxis : public Axis {
-
- private:
- int id;
- int axis;
- float pos;
- float angle;
-
- public:
-
- JoystickAxis (int id_, int axis_, float angle_);
-
- virtual const float& get_pos () const;
- virtual const float& get_angle () const;
-
- virtual void update (float);
-
- private:
- JoystickAxis (const JoystickAxis&);
- JoystickAxis& operator= (const JoystickAxis&);
- };
-
-} // namespace Axes
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axes/mouse_axis.cpp (from rev 2685,
branches/pingus_sdl/src/input/axes/mouse_axis.cxx)
Deleted: branches/pingus_sdl/src/input/axes/mouse_axis.cxx
===================================================================
--- branches/pingus_sdl/src/input/axes/mouse_axis.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/axes/mouse_axis.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,93 +0,0 @@
-// $Id: mouse_axis.cxx,v 1.2 2003/04/19 10:23:19 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <ClanLib/Display/Input/input.h>
-#include <ClanLib/Display/Input/inputdevice.h>
-#include <ClanLib/Display/Input/inputcursor.h>
-#include "mouse_axis.hxx"
-
-namespace Input {
-
- namespace Axes {
-
- MouseAxis::MouseAxis(int axis_, float angle_) : axis(axis_),
angle(angle_), pos(0), old_pos(0)
- {
- if (angle < 0)
- angle = (static_cast<int>(angle) % 360) + 360;
- else if (angle > 360)
- angle = static_cast<int>(angle) % 360;
-
- switch (axis)
- {
- case 0: old_pos = CL_Input::pointers[0]->get_cursor(0)->get_x();
- break;
- case 1: old_pos = CL_Input::pointers[0]->get_cursor(0)->get_y();
- break;
- default: old_pos = 0;
- }
- }
-
- const float&
- MouseAxis::get_pos () const
- {
- return pos;
- }
-
- const float&
- MouseAxis::get_angle () const
- {
- return angle;
- }
-
- void
- MouseAxis::update (float)
- {
- switch (axis)
- {
- case 0: if (old_pos !=
CL_Input::pointers[0]->get_cursor(0)->get_x())
- {
- pos = CL_Input::pointers[0]->get_cursor(0)->get_x()
- old_pos;
- old_pos = CL_Input::pointers[0]->get_cursor(0)->get_x();
-
- if (pos < -1)
- pos = -1;
- else if (pos > 1)
- pos = 1;
- }
- break;
-
- case 1: if (old_pos !=
CL_Input::pointers[0]->get_cursor(0)->get_y())
- {
- pos = CL_Input::pointers[0]->get_cursor(0)->get_y()
- old_pos;
- old_pos = CL_Input::pointers[0]->get_cursor(0)->get_y();
-
- if (pos < -1)
- pos = -1;
- else if (pos > 1)
- pos = 1;
- }
- break;
- default: break; // do nothing
- }
- }
-
- }
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axes/mouse_axis.hpp (from rev 2685,
branches/pingus_sdl/src/input/axes/mouse_axis.hxx)
Deleted: branches/pingus_sdl/src/input/axes/mouse_axis.hxx
===================================================================
--- branches/pingus_sdl/src/input/axes/mouse_axis.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/axes/mouse_axis.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,60 +0,0 @@
-// $Id: mouse_axis.hxx,v 1.4 2003/04/19 10:23:19 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_MOUSE_AXIS_HXX
-#define HEADER_PINGUS_INPUT_MOUSE_AXIS_HXX
-
-#include "../axis.hxx"
-
-namespace Input {
-
-namespace Axes {
-
- /**
- @brief represents an axis of the mouse
-
- XML definition: <mouse-axis angle="?" axis="0/1"/>
- */
- class MouseAxis : public Axis {
-
- private:
- int axis;
- float angle;
- float pos;
- float old_pos;
-
- public:
- MouseAxis (int axis_, float angle_);
-
- virtual const float& get_pos () const;
- virtual const float& get_angle () const;
-
- virtual void update (float);
-
- private:
- MouseAxis (const MouseAxis&);
- MouseAxis& operator= (const MouseAxis&);
- };
-
-} // namespace Axes
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axes/multiple_axis.cpp (from rev 2685,
branches/pingus_sdl/src/input/axes/multiple_axis.cxx)
Deleted: branches/pingus_sdl/src/input/axes/multiple_axis.cxx
===================================================================
--- branches/pingus_sdl/src/input/axes/multiple_axis.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/axes/multiple_axis.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,67 +0,0 @@
-// $Id: multiple_axis.cxx,v 1.3 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "multiple_axis.hxx"
-
-namespace Input {
-namespace Axes {
-
-MultipleAxis::MultipleAxis (const std::vector<Axis*>& axes_) : axes(axes_),
- pos(0), angle(0)
-{
-}
-
-MultipleAxis::~MultipleAxis ()
-{
- for (std::vector<Axis*>::const_iterator it = axes.begin(); it != axes.end();
it++)
- delete *it;
-}
-
-const float&
-MultipleAxis::get_pos () const
-{
- return pos;
-}
-
-const float&
-MultipleAxis::get_angle () const
-{
- return angle;
-}
-
-void
-MultipleAxis::update (float delta)
-{
- for (std::vector<Axis*>::const_iterator it = axes.begin(); it != axes.end();
it++)
- {
- (*it)->update(delta);
- const float & temp = (*it)->get_pos();
- if (temp)
- {
- pos = temp;
- angle = (*it)->get_angle();
- }
-
- }
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axes/multiple_axis.hpp (from rev 2685,
branches/pingus_sdl/src/input/axes/multiple_axis.hxx)
Deleted: branches/pingus_sdl/src/input/axes/multiple_axis.hxx
===================================================================
--- branches/pingus_sdl/src/input/axes/multiple_axis.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/axes/multiple_axis.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,64 +0,0 @@
-// $Id: multiple_axis.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_MULTIPLE_AXIS_HXX
-#define HEADER_PINGUS_INPUT_MULTIPLE_AXIS_HXX
-
-#include <vector>
-#include "../axis.hxx"
-
-namespace Input {
-namespace Axes {
-
-/**
- @brief wrapper class, mapping multiple axes to one
-
- XML definition: <multiple-axis> <axis 1>...<axis n></multiple-axis>
- <br><br>
- angle and pos returned by this class will be the values returned by the
first class
- yielding a pos that is not null or of the first axis if none is found
-*/
-class MultipleAxis : public Axis {
-
-private:
- std::vector<Axis*> axes;
- float pos;
- float angle;
-
-public:
-
- MultipleAxis (const std::vector<Axis*>& axes_);
- ~MultipleAxis ();
-
- virtual const float& get_pos () const;
- virtual const float& get_angle () const;
-
- virtual void update (float delta);
-
-private:
- MultipleAxis (const MultipleAxis&);
- MultipleAxis& operator= (const MultipleAxis&);
-};
-
-} // namespace Axes
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axis.hpp (from rev 2685,
branches/pingus_sdl/src/input/axis.hxx)
Deleted: branches/pingus_sdl/src/input/axis.hxx
===================================================================
--- branches/pingus_sdl/src/input/axis.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/input/axis.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,51 +0,0 @@
-// $Id: axis.hxx,v 1.11 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_AXIS_HXX
-#define HEADER_PINGUS_INPUT_AXIS_HXX
-
-#include "../pingus.hxx"
-
-namespace Input {
-
-/// abstract base class which defines the axis interface
-class Axis {
-
-public:
- Axis () { }
- virtual ~Axis () { }
-
- /// yields the position of the axis in [-1;1]
- virtual const float& get_pos () const =0;
-
- /// yields the angle of axis in [0;360[ degree
- virtual const float& get_angle () const =0;
-
- virtual void update(float) =0;
-
-private:
- Axis (const Axis&);
- Axis& operator= (const Axis&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axis_factory.cpp (from rev 2685,
branches/pingus_sdl/src/input/axis_factory.cxx)
Deleted: branches/pingus_sdl/src/input/axis_factory.cxx
===================================================================
--- branches/pingus_sdl/src/input/axis_factory.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/axis_factory.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,110 +0,0 @@
-// $Id: axis_factory.cxx,v 1.16 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../pingus_error.hxx"
-#include "axis_factory.hxx"
-#include "button.hxx"
-#include "button_factory.hxx"
-#include "axes/button_axis.hxx"
-#include "axes/inverted_axis.hxx"
-#include "axes/joystick_axis.hxx"
-#include "axes/multiple_axis.hxx"
-#include "../debug.hxx"
-
-namespace Input {
-
-using namespace Axes;
-
-Axis* AxisFactory::create(FileReader reader)
-{
- if (reader.get_name() == "button-axis")
- return button_axis(reader);
-
- else if (reader.get_name() == "inverted-axis")
- return inverted_axis(reader);
-
- else if (reader.get_name() == "joystick-axis")
- return joystick_axis(reader);
-
- else if (reader.get_name() == "multiple-axis")
- return multiple_axis(reader);
-
- else
- PingusError::raise(std::string("Unknown axis type: ") + reader.get_name());
-
- return 0; // never reached
-}
-
-Axis* AxisFactory::button_axis (FileReader reader)
-{
- float angle;
- if (!reader.read_float("angle", angle))
- PingusError::raise("ButtonAxis without angle parameter");
-
- const std::vector<FileReader>& sections = reader.get_sections();
-
- if (sections.size() != 3)
- PingusError::raise("ButtonAxis isn't <angle><button><button>");
-
- Button* button1 = ButtonFactory::create(sections[1]);
- Button* button2 = ButtonFactory::create(sections[2]);
-
- return new ButtonAxis(angle, button1, button2);
-}
-
-Axis* AxisFactory::inverted_axis (FileReader reader)
-{
- return new InvertedAxis(create(reader));
-}
-
-Axis* AxisFactory::joystick_axis (FileReader reader)
-{
- float angle;
- if (!reader.read_float("angle", angle))
- PingusError::raise("JoystickAxis without angle parameter");
-
- int id;
- if (!reader.read_int("id", id))
- PingusError::raise("JoystickAxis without id parameter");
-
- int axis;
- if (!reader.read_int("axis", axis))
- PingusError::raise("JoystickAxis without axis parameter");
-
- return new JoystickAxis(id, axis, angle);
-}
-
-Axis* AxisFactory::multiple_axis (FileReader reader)
-{
- std::vector<Axis*> axes;
-
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- axes.push_back(create(*i));
-
- if (!axes.size())
- PingusError::raise("MultipleAxis without any axis");
-
- return new MultipleAxis(axes);
-}
-
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/axis_factory.hpp (from rev 2685,
branches/pingus_sdl/src/input/axis_factory.hxx)
Deleted: branches/pingus_sdl/src/input/axis_factory.hxx
===================================================================
--- branches/pingus_sdl/src/input/axis_factory.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/axis_factory.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,50 +0,0 @@
-// $Id: axis_factory.hxx,v 1.10 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_AXIS_FACTORY_HXX
-#define HEADER_PINGUS_INPUT_AXIS_FACTORY_HXX
-
-#include "../file_reader.hxx"
-
-namespace Input {
-
-class Axis;
-
-class AxisFactory
-{
-private:
- static Axis* button_axis (FileReader reader);
- static Axis* inverted_axis (FileReader reader);
- static Axis* joystick_axis (FileReader reader);
- static Axis* multiple_axis (FileReader reader);
-
-public:
- static Axis* create (FileReader reader);
-
-private:
- AxisFactory ();
- AxisFactory (const AxisFactory&);
- AxisFactory& operator= (const AxisFactory&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/button.hpp (from rev 2685,
branches/pingus_sdl/src/input/button.hxx)
Deleted: branches/pingus_sdl/src/input/button.hxx
===================================================================
--- branches/pingus_sdl/src/input/button.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/input/button.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,54 +0,0 @@
-// $Id: button.hxx,v 1.11 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_BUTTON_HXX
-#define HEADER_PINGUS_INPUT_BUTTON_HXX
-
-#include "../pingus.hxx"
-
-namespace Input {
-
-/// abstract base class which defines the button interface
-class Button
-{
-public:
- Button () { }
- virtual ~Button () { }
-
- /// returns true if the button is pressed, false otherwise
- virtual bool is_pressed () const =0;
- virtual void update (float) =0;
-
- CL_Signal_v0& sig_button_down() { return button_down; }
- CL_Signal_v0& sig_button_up() { return button_up; }
-
-protected:
- CL_Signal_v0 button_down;
- CL_Signal_v0 button_up;
-
-private:
- Button (const Button&);
- Button& operator= (const Button&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/button_factory.cpp (from rev 2685,
branches/pingus_sdl/src/input/button_factory.cxx)
Deleted: branches/pingus_sdl/src/input/button_factory.cxx
===================================================================
--- branches/pingus_sdl/src/input/button_factory.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/button_factory.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,140 +0,0 @@
-// $Id: button_factory.cxx,v 1.13 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <ClanLib/Display/keyboard.h>
-#include <ClanLib/Display/input_device.h>
-#include "../file_reader.hxx"
-#include "../pingus_error.hxx"
-#include "button_factory.hxx"
-#include "buttons/double_button.hxx"
-#include "buttons/joystick_button.hxx"
-#include "buttons/key_button.hxx"
-#include "buttons/mouse_button.hxx"
-#include "buttons/multiple_button.hxx"
-#include "buttons/triple_button.hxx"
-
-namespace Input {
-
-using namespace Buttons;
-
-Button* ButtonFactory::create (FileReader reader)
-{
- if (reader.get_name() == "double-button")
- return double_button(reader);
-
- else if (reader.get_name() == "joystick-button")
- return joystick_button(reader);
-
- else if (reader.get_name() == "key-button")
- return key_button(reader);
-
- else if (reader.get_name() == "mouse-button")
- return mouse_button(reader);
-
- else if (reader.get_name() == "multiple-button")
- return multiple_button(reader);
-
- else if (reader.get_name() == "triple-button")
- return triple_button(reader);
-
- else
- PingusError::raise(std::string("Unknown button type: ") +
reader.get_name());
-
- return 0; // never reached
-}
-
-Button* ButtonFactory::double_button (FileReader reader)
-{
- const std::vector<FileReader>& sections = reader.get_sections();
-
- if (sections.size() != 2)
- PingusError::raise("DoubleButton isn't <angle><button><button>");
-
- Button *button1, *button2;
-
- button1 = create(sections[0]);
- button2 = create(sections[1]);
-
- return new DoubleButton(button1, button2);
-}
-
-Button* ButtonFactory::joystick_button (FileReader reader)
-{
- int id;
- if (!reader.read_int("id", id))
- PingusError::raise("JoystickButton without id parameter");
-
- int button;
- if (!reader.read_int("button", button))
- PingusError::raise("JoystickButton without button parameter");
-
- return new JoystickButton(id, button);
-}
-
-Button* ButtonFactory::key_button (FileReader reader)
-{
- std::string key;
- if (!reader.read_string("key", key))
- PingusError::raise("KeyButton without key parameter");
-
- return new KeyButton(CL_Keyboard::get_device().string_to_keyid(key));
-}
-
-Button* ButtonFactory::mouse_button (FileReader reader)
-{
- int button;
- if (!reader.read_int("button", button))
- PingusError::raise("MouseButton without button parameter");
-
- return new MouseButton(button);
-}
-
-Button* ButtonFactory::multiple_button (FileReader reader)
-{
- std::vector<Button*> buttons;
-
- const std::vector<FileReader>& sections = reader.get_sections();
-
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- buttons.push_back(create(*i));
-
- return new MultipleButton(buttons);
-}
-
-Button* ButtonFactory::triple_button (FileReader reader)
-{
- const std::vector<FileReader>& sections = reader.get_sections();
-
- if (sections.size() != 3)
- PingusError::raise("DoubleButton isn't <angle><button><button>");
-
- Button *button1, *button2, *button3;
-
- button1 = create(sections[0]);
- button2 = create(sections[1]);
- button3 = create(sections[2]);
-
- return new TripleButton(button1, button2, button3);
-}
-
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/button_factory.hpp (from rev 2685,
branches/pingus_sdl/src/input/button_factory.hxx)
Deleted: branches/pingus_sdl/src/input/button_factory.hxx
===================================================================
--- branches/pingus_sdl/src/input/button_factory.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/button_factory.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,52 +0,0 @@
-// $Id: button_factory.hxx,v 1.10 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_BUTTON_FACTORY_HXX
-#define HEADER_PINGUS_INPUT_BUTTON_FACTORY_HXX
-
-#include "../file_reader.hxx"
-
-namespace Input {
-
-class Button;
-
-class ButtonFactory
-{
-private:
- static Button* double_button (FileReader reader);
- static Button* joystick_button (FileReader reader);
- static Button* key_button (FileReader reader);
- static Button* mouse_button (FileReader reader);
- static Button* multiple_button (FileReader reader);
- static Button* triple_button (FileReader reader);
-
-public:
- static Button* create (FileReader reader);
-
-private:
- ButtonFactory ();
- ButtonFactory (const ButtonFactory&);
- ButtonFactory& operator= (const ButtonFactory&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/double_button.cpp (from rev 2685,
branches/pingus_sdl/src/input/buttons/double_button.cxx)
Deleted: branches/pingus_sdl/src/input/buttons/double_button.cxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/double_button.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/double_button.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,67 +0,0 @@
-// $Id: double_button.cxx,v 1.3 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../event_fwd.hxx"
-#include "double_button.hxx"
-
-namespace Input {
-namespace Buttons {
-
-DoubleButton::DoubleButton (Button* button1_, Button* button2_) :
button1(button1_), button2(button2_),
-
first_pressed(false), ignore_second(false)
-{
-}
-
-DoubleButton::~DoubleButton ()
-{
- delete button1;
- delete button2;
-}
-
-void
-DoubleButton::update (float delta)
-{
- button1->update(delta);
- button2->update(delta);
-
- if (button1->is_pressed())
- {
- if (!first_pressed)
- {
- first_pressed = true;
- ignore_second = button2->is_pressed();
- }
- }
- else
- {
- first_pressed = false;
- ignore_second = true;
- }
-}
-
-bool
-DoubleButton::is_pressed () const
-{
- return ( ! ignore_second && first_pressed && button2->is_pressed());
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/double_button.hpp (from rev 2685,
branches/pingus_sdl/src/input/buttons/double_button.hxx)
Deleted: branches/pingus_sdl/src/input/buttons/double_button.hxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/double_button.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/double_button.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,63 +0,0 @@
-// $Id: double_button.hxx,v 1.5 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_DOUBLE_BUTTON_HXX
-#define HEADER_PINGUS_INPUT_DOUBLE_BUTTON_HXX
-
-#include "../button.hxx"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief allows two buttons to be used in combination
-
- XML definition: <double-button><button1><button2></double-button>
-
- This class allows combinations like CTRL-X whereby it's important that the
first
- key is pressed before the second else the DoubleButton itself won't change
it's
- own state to pressed.
-*/
-class DoubleButton : public Button {
-
-private:
- Button* const button1;
- Button* const button2;
- bool first_pressed;
- bool ignore_second;
-
-public:
-
- DoubleButton (Button* button1_, Button* button2_);
- ~DoubleButton ();
-
- virtual bool is_pressed () const;
- virtual void update (float delta);
-
-private:
- DoubleButton (const DoubleButton&);
- DoubleButton& operator= (const DoubleButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/dummy_button.hpp (from rev 2685,
branches/pingus_sdl/src/input/buttons/dummy_button.hxx)
Deleted: branches/pingus_sdl/src/input/buttons/dummy_button.hxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/dummy_button.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/dummy_button.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,50 +0,0 @@
-// $Id: dummy_button.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_DUMMY_BUTTON_HXX
-#define HEADER_PINGUS_INPUT_DUMMY_BUTTON_HXX
-
-#include "../button.hxx"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief dummy class to be used if a button is required but not defined
-
- XML definition: none
-*/
-class DummyButton : public Button {
-public:
- DummyButton () { }
-
- virtual bool is_pressed () const { return false; }
- virtual void update (float) { }
-
-private:
- DummyButton (const DummyButton&);
- DummyButton& operator= (const DummyButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/joystick_button.cpp (from rev
2685, branches/pingus_sdl/src/input/buttons/joystick_button.cxx)
Deleted: branches/pingus_sdl/src/input/buttons/joystick_button.cxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/joystick_button.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/joystick_button.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,53 +0,0 @@
-// $Id: joystick_button.cxx,v 1.6 2003/12/13 16:23:40 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <ClanLib/Core/System/clanstring.h>
-#include <ClanLib/Display/joystick.h>
-#include <ClanLib/Display/input_device.h>
-//#include <ClanLib/Display/input_button.h>
-#include "joystick_button.hxx"
-#include "../../pingus_error.hxx"
-
-namespace Input {
-namespace Buttons {
-
-JoystickButton::JoystickButton(int id_, int button_) : id(id_), button(button_)
-{
- if (id >= CL_Joystick::get_device_count())
- PingusError::raise("JoystickButton: Invalid joystick id: " +
CL_String::to(id));
-
- if (button > CL_Joystick::get_device(id).get_button_count())
- PingusError::raise("JoystickButton: Invalid joystick button id: " +
CL_String::to(button));
-}
-
-void
-JoystickButton::update(float)
-{
-}
-
-bool
-JoystickButton::is_pressed() const
-{
- return CL_Joystick::get_device(id).get_keycode(button);
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/joystick_button.hpp (from rev
2685, branches/pingus_sdl/src/input/buttons/joystick_button.hxx)
Deleted: branches/pingus_sdl/src/input/buttons/joystick_button.hxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/joystick_button.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/joystick_button.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,56 +0,0 @@
-// $Id: joystick_button.hxx,v 1.5 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_JOYSTICK_BUTTON_HXX
-#define HEADER_PINGUS_INPUT_JOYSTICK_BUTTON_HXX
-
-#include "../button.hxx"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief represents a button of a joystick
-
- XML definition: <joystick-button id="joystick id" button="button num"/>
-*/
-class JoystickButton : public Button {
-
-private:
- int id;
- int button;
-
-public:
-
- JoystickButton (int id_, int button_);
-
- virtual bool is_pressed () const;
- virtual void update (float);
-
-private:
- JoystickButton (const JoystickButton&);
- JoystickButton& operator= (const JoystickButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/key_button.cpp (from rev 2685,
branches/pingus_sdl/src/input/buttons/key_button.cxx)
Deleted: branches/pingus_sdl/src/input/buttons/key_button.cxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/key_button.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/key_button.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,71 +0,0 @@
-// $Id: key_button.cxx,v 1.5 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <ClanLib/Display/keyboard.h>
-#include <ClanLib/Display/input_event.h>
-#include "key_button.hxx"
-
-#include <iostream>
-
-namespace Input {
-namespace Buttons {
-
-KeyButton::KeyButton (int button_)
- : button(button_),
- key_press (CL_Keyboard::sig_key_down().connect(this,
&Input::Buttons::KeyButton::key_press_handler)),
- key_release(CL_Keyboard::sig_key_up().connect(this,
&Input::Buttons::KeyButton::key_release_handler)),
- pressed(false)
-{
-}
-
-void
-KeyButton::update (float)
-{
-}
-
-bool
-KeyButton::is_pressed () const
-{
- return pressed;
-}
-
-void
-KeyButton::key_press_handler (const CL_InputEvent& event)
-{
- if (event.id == button)
- {
- pressed = true;
- button_down();
- }
-}
-
-void
-KeyButton::key_release_handler (const CL_InputEvent& event)
-{
- if (event.id == button)
- {
- pressed = false;
- button_up();
- }
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/key_button.hpp (from rev 2685,
branches/pingus_sdl/src/input/buttons/key_button.hxx)
Deleted: branches/pingus_sdl/src/input/buttons/key_button.hxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/key_button.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/key_button.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,65 +0,0 @@
-// $Id: key_button.hxx,v 1.8 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_KEY_BUTTON_HXX
-#define HEADER_PINGUS_INPUT_KEY_BUTTON_HXX
-
-#include <ClanLib/Signals/slot.h>
-#include "../button.hxx"
-
-class CL_InputEvent;
-class CL_InputDevice;
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief maps a keyboard key to a button
-
- XML definition: <key-button button="key name"/>
-*/
-class KeyButton : public Button {
-
-private:
- int button;
- CL_Slot key_press;
- CL_Slot key_release;
- bool pressed;
-
-public:
-
- KeyButton (int button_);
-
- virtual bool is_pressed () const;
- virtual void update (float);
-
-private:
- void key_press_handler (const CL_InputEvent& event);
- void key_release_handler (const CL_InputEvent& event);
-
- KeyButton (const KeyButton&);
- KeyButton& operator= (const KeyButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/mouse_button.cpp (from rev 2685,
branches/pingus_sdl/src/input/buttons/mouse_button.cxx)
Deleted: branches/pingus_sdl/src/input/buttons/mouse_button.cxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/mouse_button.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/mouse_button.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,108 +0,0 @@
-// $Id: mouse_button.cxx,v 1.6 2003/12/13 16:23:40 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <ClanLib/Core/System/clanstring.h>
-#include <ClanLib/Display/input_event.h>
-#include <ClanLib/Display/keys.h>
-#include <ClanLib/Display/mouse.h>
-#include "mouse_button.hxx"
-#include "../../pingus_error.hxx"
-
-namespace Input {
-namespace Buttons {
-
-MouseButton::MouseButton (int button_)
- : button(button_),
- button_press_slot (CL_Mouse::sig_key_down().connect(this,
&Input::Buttons::MouseButton::press_handler)),
- button_release_slot(CL_Mouse::sig_key_up().connect(this,
&Input::Buttons::MouseButton::release_handler)),
- pressed(false)
-{
-}
-
-void
-MouseButton::update (float)
-{
-}
-
-void
-MouseButton::press_handler (const CL_InputEvent& signal) // may not be a
member function since CL_Signal doesn't take a member function pointer
-{
- switch (button)
- {
- case 0:
- if (signal.id == CL_MOUSE_LEFT) {
- pressed = true;
- button_down();
- }
- break;
-
- case 1:
- if (signal.id == CL_MOUSE_MIDDLE) {
- pressed = true;
- button_down();
- }
- break;
-
- case 2:
- if (signal.id == CL_MOUSE_RIGHT) {
- pressed = true;
- button_down();
- }
- break;
-
- default: // only three buttons support so far
- break;
- }
-}
-
-void
-MouseButton::release_handler (const CL_InputEvent& signal) // may not be a
member function since CL_Signal doesn't take a member function pointer
-{
- switch (button)
- {
- case 0:
- if (signal.id == CL_MOUSE_LEFT) {
- pressed = false;
- button_up();
- }
- break;
-
- case 1:
- if (signal.id == CL_MOUSE_MIDDLE) {
- pressed = false;
- button_up();
- }
- break;
-
- case 2:
- if (signal.id == CL_MOUSE_RIGHT) {
- pressed = false;
- button_up();
- }
- break;
-
- default: // only three buttons support so far
- break;
- }
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/mouse_button.hpp (from rev 2685,
branches/pingus_sdl/src/input/buttons/mouse_button.hxx)
Deleted: branches/pingus_sdl/src/input/buttons/mouse_button.hxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/mouse_button.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/mouse_button.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,64 +0,0 @@
-// $Id: mouse_button.hxx,v 1.7 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_MOUSE_BUTTON_HXX
-#define HEADER_PINGUS_INPUT_MOUSE_BUTTON_HXX
-
-#include <ClanLib/Signals/slot.h>
-#include "../button.hxx"
-
-class CL_InputEvent;
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief represents a mouse button
-
- XML definition: <mouse-button button="button num"/>
-*/
-class MouseButton : public Button {
-
-private:
- int button;
- CL_Slot button_press_slot;
- CL_Slot button_release_slot;
- bool pressed;
-
-public:
- MouseButton (int button_);
-
- virtual bool is_pressed () const { return pressed; }
- virtual void update (float);
-
-private:
- void press_handler (const CL_InputEvent& number);
- void release_handler (const CL_InputEvent& number);
-
- MouseButton (const MouseButton&);
- MouseButton& operator= (const MouseButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/input/buttons/multiple_button.cpp (from rev
2685, branches/pingus_sdl/src/input/buttons/multiple_button.cxx)
Deleted: branches/pingus_sdl/src/input/buttons/multiple_button.cxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/multiple_button.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/multiple_button.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,83 +0,0 @@
-// $Id: multiple_button.cxx,v 1.3 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "multiple_button.hxx"
-
-namespace Input {
-namespace Buttons {
-
-MultipleButton::MultipleButton (const std::vector<Button*>& buttons_) :
buttons(buttons_)
-{
- down_count = 0;
-
- for (std::vector<Button*>::iterator it = buttons.begin(); it !=
buttons.end(); it++)
- {
- slots.push_back((*it)->sig_button_up() .connect(this,
&MultipleButton::on_button_up));
- slots.push_back((*it)->sig_button_down().connect(this,
&MultipleButton::on_button_down));
- }
-}
-
-MultipleButton::~MultipleButton ()
-{
- for (std::vector<Button*>::iterator it = buttons.begin(); it !=
buttons.end(); it++)
- delete *it;
-}
-
-void
-MultipleButton::update (float delta)
-{
- for (std::vector<Button*>::iterator it = buttons.begin(); it !=
buttons.end(); it++)
- (*it)->update(delta);
-}
-
-bool
-MultipleButton::is_pressed () const
-{
- for (std::vector<Button*>::const_iterator it = buttons.begin(); it !=
buttons.end(); it++)
- if ((*it)->is_pressed())
- return true;
-
- return false;
-}
-
-void
-MultipleButton::on_button_up()
-{
- down_count -= 1;
- if (down_count < 0)
- down_count = 0;
-
- if (down_count == 0)
- button_up();
-}
-
-void
-MultipleButton::on_button_down()
-{
- if (down_count == 0)
- button_down();
-
- down_count += 1;
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/multiple_button.hpp (from rev
2685, branches/pingus_sdl/src/input/buttons/multiple_button.hxx)
Deleted: branches/pingus_sdl/src/input/buttons/multiple_button.hxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/multiple_button.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/multiple_button.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,62 +0,0 @@
-// $Id: multiple_button.hxx,v 1.5 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_MULTIPLE_BUTTON_HXX
-#define HEADER_PINGUS_INPUT_MULTIPLE_BUTTON_HXX
-
-#include <vector>
-#include "../button.hxx"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief wrapper class mapping multiple buttons into one
-
- XML definition: <multiple-button> <button 1>...<button n> </multiple-button>
-
- A multiple button is pressed whenever at least one of the buttons contained
is pressed.
-*/
-class MultipleButton : public Button {
-
-private:
- std::vector<Button*> buttons;
- std::vector<CL_Slot> slots;
- int down_count;
-public:
- MultipleButton (const std::vector<Button*>& buttons_);
- ~MultipleButton ();
-
- virtual bool is_pressed () const;
- virtual void update (float delta);
-
-private:
- void on_button_up();
- void on_button_down();
-
- MultipleButton (const MultipleButton&);
- MultipleButton& operator= (const MultipleButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/triple_button.cpp (from rev 2685,
branches/pingus_sdl/src/input/buttons/triple_button.cxx)
Deleted: branches/pingus_sdl/src/input/buttons/triple_button.cxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/triple_button.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/triple_button.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,72 +0,0 @@
-// $Id: triple_button.cxx,v 1.3 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "triple_button.hxx"
-
-namespace Input {
-namespace Buttons {
-
-TripleButton::TripleButton (Button* button1_, Button* button2_, Button*
button3_)
- : button1(button1_),
- button2(button2_),
- button3(button3_),
- first_second_pressed(false),
- ignore_third(false)
-{
-}
-
-TripleButton::~TripleButton ()
-{
- delete button1;
- delete button2;
- delete button3;
-}
-
-void
-TripleButton::update (float delta)
-{
- button1->update(delta);
- button2->update(delta);
- button3->update(delta);
-
- if (button1->is_pressed() && button2->is_pressed())
- {
- if (!first_second_pressed)
- {
- first_second_pressed = true;
- ignore_third = button3->is_pressed();
- }
- }
- else
- {
- first_second_pressed = false;
- ignore_third = true;
- }
-}
-
-bool
-TripleButton::is_pressed() const
-{
- return ( ! ignore_third && first_second_pressed && button3->is_pressed());
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/buttons/triple_button.hpp (from rev 2685,
branches/pingus_sdl/src/input/buttons/triple_button.hxx)
Deleted: branches/pingus_sdl/src/input/buttons/triple_button.hxx
===================================================================
--- branches/pingus_sdl/src/input/buttons/triple_button.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/buttons/triple_button.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,64 +0,0 @@
-// $Id: triple_button.hxx,v 1.5 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_TRIPLE_BUTTON_HXX
-#define HEADER_PINGUS_INPUT_TRIPLE_BUTTON_HXX
-
-#include "../button.hxx"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief allows three buttons to be used in combination
-
- XML definition: <triple-button> <button1><button2><button3> </triple-button>
-
- This class allows combinations like CTRL-ALT-R whereby it's important that
the first
- two keys are pressed before the third else the TripleButton itself won't
change it's
- own state to pressed. The order in which the first two keys are pressed is
of no
- importance, such behaviour may be created by using nested DoubleButtons.
-*/
-class TripleButton : public Button {
-
-private:
- Button* const button1;
- Button* const button2;
- Button* const button3;
- bool first_second_pressed;
- bool ignore_third;
-
-public:
- TripleButton (Button* button1_, Button* button2_, Button* button3_);
- ~TripleButton ();
-
- virtual bool is_pressed () const;
- virtual void update (float delta);
-
-private:
- TripleButton (const TripleButton&);
- TripleButton& operator= (const TripleButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/controller.cpp (from rev 2685,
branches/pingus_sdl/src/input/controller.cxx)
Deleted: branches/pingus_sdl/src/input/controller.cxx
===================================================================
--- branches/pingus_sdl/src/input/controller.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/controller.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,335 +0,0 @@
-// $Id: controller.cxx,v 1.29 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "SDL.h"
-#include "../gui/screen_manager.hxx"
-
-#include "../debug.hxx"
-#include "../pingus_error.hxx"
-
-#include "controller.hxx"
-#include "axes/dummy_axis.hxx"
-////#include "buttons/dummy_button.hxx"
-#include "pointers/dummy_pointer.hxx"
-#include "scrollers/dummy_scroller.hxx"
-#include "pointer_factory.hxx"
-////#include "../xml_file_reader.hxx"
-#include "scroller_factory.hxx"
-////#include "button_factory.hxx"
-
-namespace Input {
-
-using namespace Axes;
-////using namespace Buttons;
-using namespace Pointers;
-using namespace Scrollers;
-
-Controller* Controller::current_controller = 0;
-
-Controller::Controller (const std::string& configfile)
- : standard_pointer(0),
- scroller(0),
- std_pointer_x(0),
- std_pointer_y(0)
-{
-#if 0
- CL_InputSourceProvider_File provider(".");
- CL_DomDocument doc(provider.open_source(configfile), true);
-
- XMLFileReader reader(doc.get_document_element());
-
- if (reader.get_name() != "pingus-controller")
- {
- PingusError::raise("Controller: invalid config file <" + configfile +
">");
- }
- else
- {
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- {
- if (i->get_name() == "standard-pointer")
- standard_pointer = PointerFactory::create(i->get_sections()[0]);
-
- else if (i->get_name() == "scroller")
- scroller = ScrollerFactory::create(i->get_sections()[0]);
-
- else if (i->get_name() == "primary-button")
- buttons[primary] = ButtonFactory::create(i->get_sections()[0]);
-
- else if (i->get_name() == "secondary-button")
- buttons[secondary] = ButtonFactory::create(i->get_sections()[0]);
-
- else if (i->get_name() == "pause-button")
- buttons[pause] = ButtonFactory::create(i->get_sections()[0]);
-
- else if (i->get_name() == "fast-forward-button")
- buttons[fast_forward] =
ButtonFactory::create(i->get_sections()[0]);
-
- else if (i->get_name() == "armageddon-button")
- buttons[armageddon] = ButtonFactory::create(i->get_sections()[0]);
-
- else if (i->get_name() == "escape-button")
- buttons[escape] = ButtonFactory::create(i->get_sections()[0]);
-
- else if (i->get_name() == "action-buttons")
- create_action_buttons(*i);
-
- else if (i->get_name() == "action-up")
- buttons[action_up] = ButtonFactory::create(i->get_sections()[0]);
-
- else if (i->get_name() == "action-down")
- buttons[action_down] = ButtonFactory::create(i->get_sections()[0]);
-
- else
- PingusError::raise(std::string("Unkown Element in Controller
Config: ")
- + i->get_name());
- }
- }
-
- if (!standard_pointer)
- {
- standard_pointer = new DummyPointer;
- pwarn << "Controller: No standard pointer - inserting dummy" <<
std::endl;
- }
- else
- {
- std_pointer_x = standard_pointer->get_x_pos();
- std_pointer_y = standard_pointer->get_y_pos();
- }
-
- if (!scroller)
- {
- scroller = new DummyScroller;
- pwarn << "Controller: No scroller - inserting dummy" << std::endl;
- }
-
- if (!buttons.count(primary))
- {
- buttons[primary] = new DummyButton;
- pwarn << "Controller: No primary button - inserting dummy" << std::endl;
- }
-
- if (!buttons.count(secondary))
- {
- buttons[secondary] = new DummyButton;
- pwarn << "Controller: No secondary button - inserting dummy" <<
std::endl;
- }
-
- if (!buttons.count(pause))
- {
- buttons[pause] = new DummyButton;
- pwarn << "Controller: No pause button - inserting dummy" << std::endl;
- }
-
- if (!buttons.count(fast_forward))
- {
- buttons[fast_forward] = new DummyButton;
- pwarn << "Controller: No fast_forward button - inserting dummy" <<
std::endl;
- }
-
- if (!buttons.count(armageddon))
- {
- buttons[armageddon] = new DummyButton;
- pwarn << "Controller: No armageddon button - inserting dummy" <<
std::endl;
- }
-
- if (!buttons.count(escape))
- {
- buttons[escape] = new DummyButton;
- pwarn << "Controller: No escape button - inserting dummy" << std::endl;
- }
-
- if (!buttons.count(action_up))
- {
- buttons[action_up] = new DummyButton;
- pwarn << "Controller: No action up button - inserting dummy" <<
std::endl;
- }
-
- if (!buttons.count(action_down))
- {
- buttons[action_down] = new DummyButton;
- pwarn << "Controller: No action down button - inserting dummy" <<
std::endl;
- }
-
- for (std::map<ButtonName, Button*>::iterator it = buttons.begin(); it !=
buttons.end(); ++it)
- {
- slots.push_back(it->second->sig_button_down().connect(this,
&Controller::on_button_down, it->first));
- slots.push_back(it->second->sig_button_up().connect(this,
&Controller::on_button_up, it->first));
- }
-
- // Catch all keyboard input
- CL_InputDevice keyboard =
CL_Display::get_current_window()->get_ic()->get_keyboard();
- slots.push_back(keyboard.sig_key_down().connect(this,
&Controller::key_pressed));
-#endif
-}
-
-Controller::~Controller ()
-{
-#if 0
- delete scroller;
- delete standard_pointer;
-
- for (std::map<ButtonName, Button*>::iterator it = buttons.begin(); it !=
buttons.end(); ++it)
- delete it->second;
-#endif
-}
-
-void
-Controller::create_action_buttons (FileReader reader)
-{
-#if 0
- int count = 0;
-
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- {
- if (i->get_name() == "action-button")
- buttons[static_cast<ButtonName>(action_1 + count)]
- = ButtonFactory::create(i->get_sections()[0]);
- else
- PingusError::raise(std::string("Wrong Element in Controller Config
(action-buttons): ")
- + i->get_name());
- count += 1;
- }
-#endif
-}
-
-void
-Controller::update (float delta)
-{
- // Let SDL fetch events
- SDL_Event event;
- while(SDL_PollEvent(&event))
- {
- switch(event.type)
- {
- case SDL_QUIT:
- ScreenManager::instance()->pop_screen();
- break;
-
- case SDL_MOUSEMOTION:
- events.push_back(makePointerEvent(Input::standard, event.motion.x,
event.motion.y));
- break;
-
- case SDL_MOUSEBUTTONDOWN:
- if (event.button.button == SDL_BUTTON_LEFT)
- events.push_back(makeButtonEvent(Input::primary, Input::pressed));
- else if (event.button.button == SDL_BUTTON_MIDDLE)
- events.push_back(makeButtonEvent(Input::pause, Input::pressed));
- else if (event.button.button == SDL_BUTTON_RIGHT)
- events.push_back(makeButtonEvent(Input::secondary,
Input::pressed));
- break;
-
- case SDL_MOUSEBUTTONUP:
- if (event.button.button == SDL_BUTTON_LEFT)
- events.push_back(makeButtonEvent(Input::primary, Input::released));
- else if (event.button.button == SDL_BUTTON_MIDDLE)
- events.push_back(makeButtonEvent(Input::pause, Input::released));
- else if (event.button.button == SDL_BUTTON_RIGHT)
- events.push_back(makeButtonEvent(Input::secondary,
Input::released));
- break;
-
- case SDL_KEYDOWN:
- break;
-
- case SDL_KEYUP:
- break;
-
- default:
- // FIXME: feed other events to the input manager
- break;
- }
- }
-
-#if 0
- scroller ->update(delta);
- standard_pointer->update(delta);
-
- for (std::map<ButtonName, Button*>::iterator it = buttons.begin(); it !=
buttons.end(); ++it)
- it->second->update(delta);
-
- // FIXME: Busy checking of button status and other events is *VERY EVIL*
- if (std_pointer_x != standard_pointer->get_x_pos()
- || std_pointer_y != standard_pointer->get_y_pos())
- {
- std_pointer_x = standard_pointer->get_x_pos();
- std_pointer_y = standard_pointer->get_y_pos();
-
- events.push_back(makePointerEvent(standard, std_pointer_x,
std_pointer_y));
- }
-
- // FIXME: Busy checking of button status and other events is *VERY EVIL*
- if (scroller->get_x_delta() || scroller->get_y_delta())
- events.push_back(makeScrollEvent(scroller->get_x_delta(),
scroller->get_y_delta()));
-
- std::string keys_pressed = get_keys_pressed();
- for (unsigned i = 0; i < (unsigned)keys_pressed.length(); i++)
- {
- events.push_back(makeKeyboardEvent( keys_pressed[i] ));
- }
-#endif
-}
-
-void
-Controller::clear()
-{
- events.clear ();
-}
-
-const Button*
-Controller::get_button (ButtonName name)
-{
- if (buttons.count(name))
- return buttons[name];
-
- return 0;
-}
-
-void
-Controller::on_button_down(ButtonName name)
-{
- events.push_back(makeButtonEvent(name, pressed));
-}
-
-void
-Controller::on_button_up(ButtonName name)
-{
- events.push_back(makeButtonEvent(name, released));
-}
-#if 0
-void
-Controller::key_pressed(const CL_InputEvent &event)
-{
- keys += event.str;
-}
-#endif
-std::string
-Controller::get_keys_pressed()
-{
- std::string ret_keys = keys;
- keys.clear();
- return ret_keys;
-}
-
-
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/controller.hpp (from rev 2685,
branches/pingus_sdl/src/input/controller.hxx)
Deleted: branches/pingus_sdl/src/input/controller.hxx
===================================================================
--- branches/pingus_sdl/src/input/controller.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/controller.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,91 +0,0 @@
-// $Id: controller.hxx,v 1.20 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_CONTROLLER_HXX
-#define HEADER_PINGUS_INPUT_CONTROLLER_HXX
-
-#include <map>
-#include <list>
-#include <string>
-#include <vector>
-#include "../file_reader.hxx"
-#include "event.hxx"
-
-namespace Input {
-
-class Axis;
-class Button;
-class Pointer;
-class Scroller;
-
-class Controller {
-
-private:
- Pointer* standard_pointer;
- Scroller* scroller;
-
- std::map<ButtonName, Button*> buttons;
-
- std::vector<Event> events;
-
- float std_pointer_x;
- float std_pointer_y;
-
- //// std::vector<CL_Slot> slots;
-
-public:
- Controller (const std::string& configfile);
- ~Controller ();
-
- std::vector<Event>& get_events () { return events; }
-
- const Pointer * get_pointer () const { return standard_pointer; }
- const Scroller* get_scroller () const { return scroller; }
-
- /// returns the requested Buttons::Button or 0 if it doesn't exist (e.g.
undefined action Buttons::Button)
- const Button* get_button (ButtonName name);
-
- void update (float delta);
- void clear();
-
- static void set_current(Controller* controller) { current_controller =
controller; }
- static Controller* get_current() { return current_controller; }
-
-private:
- static Controller* current_controller;
-
- void on_button_down(ButtonName name);
- void on_button_up(ButtonName name);
- void create_action_buttons (FileReader reader);
- ////void key_pressed(const CL_InputEvent &event);
-
-/** Get keyboard keys pressed to handle general keyboard input */
- std::string get_keys_pressed();
-
- std::string keys;
-
- Controller (const Controller&);
- Controller& operator= (const Controller&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/event.hpp (from rev 2685,
branches/pingus_sdl/src/input/event.hxx)
Deleted: branches/pingus_sdl/src/input/event.hxx
===================================================================
--- branches/pingus_sdl/src/input/event.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/input/event.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,145 +0,0 @@
-// $Id: event.hxx,v 1.9 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_EVENT_HXX
-#define HEADER_PINGUS_INPUT_EVENT_HXX
-
-#include <vector>
-#include <string>
-#include "../pingus.hxx"
-
-namespace Input {
-
-enum EventType { ButtonEventType, PointerEventType, AxisEventType,
ScrollEventType, KeyboardEventType };
-
-enum ButtonName { primary, secondary, pause, fast_forward, armageddon, escape,
action_1, action_2,
- action_3, action_4, action_5, action_6, action_7, action_8,
action_9, action_10,
- action_up, action_down };
-
-enum State { pressed, released };
-
-struct ButtonEvent
-{
- ButtonName name;
- State state;
-};
-
-enum PointerName { standard };
-
-struct PointerEvent
-{
- PointerName name;
- float x;
- float y;
-};
-
-enum AxisName { action };
-
-struct AxisEvent
-{
- float dir;
- AxisName name;
-};
-
-struct ScrollEvent
-{
- float x_delta;
- float y_delta;
-};
-
-struct KeyboardEvent
-{
- char key;
-};
-
-struct Event
-{
- EventType type;
-
- union {
- ButtonEvent button;
- PointerEvent pointer;
- AxisEvent axis;
- ScrollEvent scroll;
- KeyboardEvent keyboard;
- };
-};
-
-typedef std::vector<Event> EventLst;
-
-inline Event makeButtonEvent (ButtonName name, State state)
-{
- Event event;
-
- event.type = ButtonEventType;
- event.button.name = name;
- event.button.state = state;
-
- return event;
-}
-
-inline Event makePointerEvent(PointerName name, float x, float y)
-{
- Event event;
-
- event.type = PointerEventType;
- event.pointer.name = name;
- event.pointer.x = x;
- event.pointer.y = y;
-
- return event;
-}
-
-inline Event makeAxisEvent (float dir, AxisName name = action)
-{
- Event event;
-
- event.type = AxisEventType;
- event.axis.dir = dir;
- event.axis.name = name;
-
- return event;
-}
-
-inline Event makeScrollEvent (float x_delta, float y_delta)
-{
- Event event;
-
- event.type = ScrollEventType;
- event.scroll.x_delta = x_delta;
- event.scroll.y_delta = y_delta;
-
- return event;
-}
-
-inline Event makeKeyboardEvent (char c)
-{
- Event event;
-
- event.type = KeyboardEventType;
- event.keyboard.key = c;
-
- return event;
-}
-
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/event_fwd.hpp (from rev 2685,
branches/pingus_sdl/src/input/event_fwd.hxx)
Deleted: branches/pingus_sdl/src/input/event_fwd.hxx
===================================================================
--- branches/pingus_sdl/src/input/event_fwd.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/input/event_fwd.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,36 +0,0 @@
-// $Id: event_fwd.hxx,v 1.4 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_EVENT_FWD_HXX
-#define HEADER_PINGUS_INPUT_EVENT_FWD_HXX
-
-#include <vector>
-
-// Forward Header for event.hxx, just here to reduce compile time
-// dependencies a bit.
-namespace Input {
-
-struct Event;
-typedef std::vector<Event> EventLst;
-
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/pointer.hpp (from rev 2685,
branches/pingus_sdl/src/input/pointer.hxx)
Deleted: branches/pingus_sdl/src/input/pointer.hxx
===================================================================
--- branches/pingus_sdl/src/input/pointer.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/input/pointer.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,54 +0,0 @@
-// $Id: pointer.hxx,v 1.12 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_POINTER_HXX
-#define HEADER_PINGUS_INPUT_POINTER_HXX
-
-#include "../pingus.hxx"
-
-namespace Input {
-
-/// abstract base class defining the pointer interface
-class Pointer
-{
-public:
- Pointer () { }
- virtual ~Pointer() { }
-
- /// returns the X coordinate of the pointer
- virtual const float& get_x_pos () const =0;
-
- /// returns the Y coordinate of the pointer
- virtual const float& get_y_pos () const =0;
-
- /// sets the pointer to the given position
- virtual void set_pos (float, float) =0;
-
- virtual void update (float) =0;
-
-private:
- Pointer (const Pointer&);
- Pointer& operator= (const Pointer&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/pointer_factory.cpp (from rev 2685,
branches/pingus_sdl/src/input/pointer_factory.cxx)
Deleted: branches/pingus_sdl/src/input/pointer_factory.cxx
===================================================================
--- branches/pingus_sdl/src/input/pointer_factory.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/pointer_factory.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,86 +0,0 @@
-// $Id: pointer_factory.cxx,v 1.11 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../pingus_error.hxx"
-#include "axis_factory.hxx"
-#include "pointers/axis_pointer.hxx"
-#include "pointers/mouse_pointer.hxx"
-#include "pointers/multiple_pointer.hxx"
-#include "pointer_factory.hxx"
-
-namespace Input {
-
-using namespace Pointers;
-
-Pointer* PointerFactory::create (FileReader reader)
-{
- if (reader.get_name() == "axis-pointer")
- return axis_pointer(reader);
-
- else if (reader.get_name() == "mouse-pointer")
- return mouse_pointer();
-
- else if (reader.get_name() == "multiple-pointer")
- return multiple_pointer(reader);
-
- else
- PingusError::raise(std::string("Unknown pointer type: ") +
reader.get_name());
-
- return 0; // never reached
-}
-
-Pointer* PointerFactory::axis_pointer (FileReader reader)
-{
- float speed;
- if (!reader.read_float("speed", speed))
- PingusError::raise("AxisPointer without speed parameter");
-
- std::vector<Axis*> axes;
-
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin() + 1;
- i != sections.end(); ++i)
- {
- axes.push_back(AxisFactory::create(*i));
- }
-
- return new AxisPointer(speed, axes);
-}
-
-Pointer* PointerFactory::mouse_pointer ()
-{
- return new MousePointer;
-}
-
-Pointer* PointerFactory::multiple_pointer (FileReader reader)
-{
- std::vector<Pointer*> pointers;
-
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- pointers.push_back(create(*i));
-
- return new MultiplePointer(pointers);
-}
-
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/pointer_factory.hpp (from rev 2685,
branches/pingus_sdl/src/input/pointer_factory.hxx)
Deleted: branches/pingus_sdl/src/input/pointer_factory.hxx
===================================================================
--- branches/pingus_sdl/src/input/pointer_factory.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/pointer_factory.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,49 +0,0 @@
-// $Id: pointer_factory.hxx,v 1.8 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_POINTER_FACTORY_HXX
-#define HEADER_PINGUS_INPUT_POINTER_FACTORY_HXX
-
-#include "../file_reader.hxx"
-
-namespace Input {
-
-class Pointer;
-
-class PointerFactory
-{
-private:
- static Pointer* axis_pointer (FileReader reader);
- static Pointer* mouse_pointer ();
- static Pointer* multiple_pointer (FileReader reader);
-
-public:
- static Pointer* create (FileReader reader);
-
-private:
- PointerFactory ();
- PointerFactory (const PointerFactory&);
- PointerFactory& operator= (const PointerFactory&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/pointers/axis_pointer.cpp (from rev 2685,
branches/pingus_sdl/src/input/pointers/axis_pointer.cxx)
Deleted: branches/pingus_sdl/src/input/pointers/axis_pointer.cxx
===================================================================
--- branches/pingus_sdl/src/input/pointers/axis_pointer.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/pointers/axis_pointer.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,74 +0,0 @@
-// $Id: axis_pointer.cxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <math.h>
-#include <assert.h>
-#include "../axis.hxx"
-#include "axis_pointer.hxx"
-
-namespace Input {
-namespace Pointers {
-
-AxisPointer::AxisPointer (float speed_, const std::vector<Axis*>& axes_) :
speed(speed_), axes(axes_)
-{
- assert(axes.size() >= 2);
- assert(axes[0]->get_angle() != axes[1]->get_angle());
-}
-
-AxisPointer::~AxisPointer ()
-{
- for (std::vector<Axis*>::const_iterator it = axes.begin(); it != axes.end();
it++)
- delete *it;
-}
-
-const float&
-AxisPointer::get_x_pos () const
-{
- return x_pos;
-}
-
-const float&
-AxisPointer::get_y_pos () const
-{
- return y_pos;
-}
-
-void
-AxisPointer::set_pos (float new_x, float new_y)
-{
- x_pos = new_x;
- y_pos = new_y;
-}
-
-void
-AxisPointer::update (float delta)
-{
- for (std::vector<Axis*>::const_iterator it = axes.begin(); it != axes.end();
it++)
- {
- (*it)->update(delta);
-
- x_pos += (float)cos((*it)->get_angle() * 3.14159265 / 180) * speed *
delta * (*it)->get_pos();
- y_pos += (float)sin((*it)->get_angle() * 3.14159265 / 180) * speed *
delta * (*it)->get_pos();
- }
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/pointers/axis_pointer.hpp (from rev 2685,
branches/pingus_sdl/src/input/pointers/axis_pointer.hxx)
Deleted: branches/pingus_sdl/src/input/pointers/axis_pointer.hxx
===================================================================
--- branches/pingus_sdl/src/input/pointers/axis_pointer.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/pointers/axis_pointer.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,73 +0,0 @@
-// $Id: axis_pointer.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_AXIS_POINTER_HXX
-#define HEADER_PINGUS_INPUT_AXIS_POINTER_HXX
-
-#include <vector>
-#include "../pointer.hxx"
-
-namespace Input {
-
-class Axis;
-
-namespace Pointers {
-
-/**
- @brief maps two or more axes into a pointer
-
- XML definition: <axis-pointer> <axis 1><axis 2>[... <axis N>]
</axis-pointer>
-
- The number of axes used to create the pointer and their respective angles is
- unlimited as long as there are at least two axes and the first two axes
must have
- different angles.
-*/
-class AxisPointer : public Pointer {
-
-private:
-
- const float speed;
- std::vector<Axis*> axes;
-
- float x_pos;
- float y_pos;
-
-public:
-
- AxisPointer (float speed, const std::vector<Axis*>& axes_);
- ~AxisPointer ();
-
- virtual const float& get_x_pos () const;
- virtual const float& get_y_pos () const;
-
- virtual void set_pos(float new_x, float new_y);
-
- virtual void update (float delta);
-
-private:
- AxisPointer (const AxisPointer&);
- AxisPointer& operator= (const AxisPointer&);
-};
-
-} // namespace Pointers
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/pointers/dummy_pointer.hpp (from rev
2685, branches/pingus_sdl/src/input/pointers/dummy_pointer.hxx)
Deleted: branches/pingus_sdl/src/input/pointers/dummy_pointer.hxx
===================================================================
--- branches/pingus_sdl/src/input/pointers/dummy_pointer.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/pointers/dummy_pointer.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,58 +0,0 @@
-// $Id: dummy_pointer.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_DUMMY_POINTER_HXX
-#define HEADER_PINGUS_INPUT_DUMMY_POINTER_HXX
-
-#include "../pointer.hxx"
-
-namespace Input {
-namespace Pointers {
-
-/**
- @brief dummy class to be used if a pointer is required but none defined
-
- XML definition: none
-*/
-class DummyPointer : public Pointer {
-
-private:
- const float pos;
-
-public:
-
- DummyPointer () : pos(0) { }
-
- virtual const float& get_x_pos () const { return pos; }
- virtual const float& get_y_pos () const { return pos; }
-
- virtual void set_pos (float, float) { }
- virtual void update (float) { }
-
-private:
- DummyPointer (const DummyPointer&);
- DummyPointer& operator= (const DummyPointer&);
-};
-
-} // namespace Pointers
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/pointers/mouse_pointer.cpp (from rev
2685, branches/pingus_sdl/src/input/pointers/mouse_pointer.cxx)
Deleted: branches/pingus_sdl/src/input/pointers/mouse_pointer.cxx
===================================================================
--- branches/pingus_sdl/src/input/pointers/mouse_pointer.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/pointers/mouse_pointer.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,68 +0,0 @@
-// $Id: mouse_pointer.cxx,v 1.6 2003/12/13 16:23:40 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <ClanLib/Display/mouse.h>
-#include <ClanLib/Display/input_event.h>
-#include "mouse_pointer.hxx"
-
-namespace Input {
-namespace Pointers {
-
-MousePointer::MousePointer ()
- : x_pos(0),
- y_pos(0),
- move_slot(CL_Mouse::sig_move().connect(this,
&Input::Pointers::MousePointer::move_signal))
-{
-}
-
-const float&
-MousePointer::get_x_pos () const
-{
- return x_pos;
-}
-
-const float&
-MousePointer::get_y_pos () const
-{
- return y_pos;
-}
-
-void
-MousePointer::set_pos (float new_x, float new_y)
-{
- CL_Mouse::set_position(static_cast<int>(new_x),
- static_cast<int>(new_y));
-}
-
-void
-MousePointer::update (float)
-{
-}
-
-void
-MousePointer::move_signal (const CL_InputEvent& event)
-{
- x_pos = (float)event.mouse_pos.x;
- y_pos = (float)event.mouse_pos.y;
-}
-
-} // namespace Pointers
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/pointers/mouse_pointer.hpp (from rev
2685, branches/pingus_sdl/src/input/pointers/mouse_pointer.hxx)
Deleted: branches/pingus_sdl/src/input/pointers/mouse_pointer.hxx
===================================================================
--- branches/pingus_sdl/src/input/pointers/mouse_pointer.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/pointers/mouse_pointer.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,65 +0,0 @@
-// $Id: mouse_pointer.hxx,v 1.7 2003/12/13 16:23:40 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_MOUSE_POINTER_HXX
-#define HEADER_PINGUS_INPUT_MOUSE_POINTER_HXX
-
-#include <ClanLib/Signals/slot.h>
-#include "../pointer.hxx"
-
-class CL_InputEvent;
-
-namespace Input {
-namespace Pointers {
-
-/**
- @brief maps the standard mouse into a pointer
-
- XML definition: <mouse-pointer/>
-*/
-class MousePointer : public Pointer {
-
-private:
- float x_pos;
- float y_pos;
- CL_Slot move_slot;
-
-public:
- MousePointer ();
-
- virtual const float& get_x_pos () const;
- virtual const float& get_y_pos () const;
-
- virtual void set_pos (float new_x, float new_y);
-
- virtual void update (float);
-
-private:
- void move_signal (const CL_InputEvent& event);
-
- MousePointer (const MousePointer&);
- MousePointer& operator= (const MousePointer&);
-};
-
-} // namespace Pointers
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/pointers/multiple_pointer.cpp (from rev
2685, branches/pingus_sdl/src/input/pointers/multiple_pointer.cxx)
Deleted: branches/pingus_sdl/src/input/pointers/multiple_pointer.cxx
===================================================================
--- branches/pingus_sdl/src/input/pointers/multiple_pointer.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/pointers/multiple_pointer.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,100 +0,0 @@
-// $Id: multiple_pointer.cxx,v 1.4 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "multiple_pointer.hxx"
-
-namespace Input {
-namespace Pointers {
-
-MultiplePointer::MultiplePointer (const std::vector<Pointer*>& pointers_)
- : pointers(pointers_),
- old_x_pos(0),
- old_y_pos(0),
- x_pos(0),
- y_pos(0)
-{
-}
-
-MultiplePointer::~MultiplePointer ()
-{
- for (unsigned int i = 0; i < pointers.size(); ++i)
- delete pointers[i];
-}
-
-const float&
-MultiplePointer::get_x_pos () const
-{
- return x_pos;
-}
-
-const float&
-MultiplePointer::get_y_pos () const
-{
- return y_pos;
-}
-
-void
-MultiplePointer::set_pos (float x_pos_, float y_pos_)
-{
- for (unsigned int i = 0; i < pointers.size(); ++i)
- pointers[i]->set_pos(x_pos_, y_pos_);
-}
-
-void
-MultiplePointer::update (float delta)
-{
- unsigned int do_break = UINT_MAX;
-
- for (unsigned int i = 0; i < pointers.size(); ++i)
- pointers[i]->update(delta);
-
- for (unsigned int i = 0; i < pointers.size(); ++i)
- {
- if (pointers[i]->get_x_pos() != old_x_pos)
- {
- old_x_pos = x_pos;
- x_pos = pointers[i]->get_x_pos();
- do_break = i;
- }
-
- if (pointers[i]->get_y_pos() != old_y_pos)
- {
- old_y_pos = y_pos;
- y_pos = pointers[i]->get_y_pos();
- do_break = i;
- }
-
- if (do_break != UINT_MAX)
- break;
- }
-
- // no pointer changed, so there's no need to update the other pointers
- if (do_break == UINT_MAX)
- return;
-
- for (unsigned int n = 0; n < pointers.size(); ++n)
- if (n != do_break)
- pointers[n]->set_pos(x_pos, y_pos);
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/input/pointers/multiple_pointer.hpp (from rev
2685, branches/pingus_sdl/src/input/pointers/multiple_pointer.hxx)
Deleted: branches/pingus_sdl/src/input/pointers/multiple_pointer.hxx
===================================================================
--- branches/pingus_sdl/src/input/pointers/multiple_pointer.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/pointers/multiple_pointer.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,70 +0,0 @@
-// $Id: multiple_pointer.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_MULTIPLE_POINTER_HXX
-#define HEADER_PINGUS_INPUT_MULTIPLE_POINTER_HXX
-
-#include <vector>
-#include "../pointer.hxx"
-
-namespace Input {
-namespace Pointers {
-
-/**
- @brief wrapper class allowing multiple pointers to be used as one
-
- XML definition: <multiple-pointer> <pointer 1>...<pointer N>
</multiple-pointer>
-
- This class will check every contained pointer for changes and if any
changes all
- pointers are updated to the new coordinates. If more than one pointer
changes at
- the same time only the change of the first will be registered.
-*/
-class MultiplePointer : public Pointer {
-
-private:
- std::vector<Pointer*> pointers;
-
- float old_x_pos;
- float old_y_pos;
-
- float x_pos;
- float y_pos;
-
-public:
- MultiplePointer (const std::vector<Pointer*>& pointers_);
- ~MultiplePointer ();
-
- virtual const float& get_x_pos () const;
- virtual const float& get_y_pos () const;
-
- virtual void set_pos (float x_pos, float y_pos);
-
- virtual void update (float delta);
-
-private:
- MultiplePointer (const MultiplePointer&);
- MultiplePointer& operator= (const MultiplePointer&);
-};
-
-} // namespace Pointers
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scroller.hpp (from rev 2685,
branches/pingus_sdl/src/input/scroller.hxx)
Deleted: branches/pingus_sdl/src/input/scroller.hxx
===================================================================
--- branches/pingus_sdl/src/input/scroller.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/input/scroller.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,53 +0,0 @@
-// $Id: scroller.hxx,v 1.9 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_SCROLLER_HXX
-#define HEADER_PINGUS_INPUT_SCROLLER_HXX
-
-#include "../pingus.hxx"
-
-namespace Input {
-
-/// abstract base class defining the scroller interface
-class Scroller {
-public:
- Scroller () { }
- virtual ~Scroller () { }
-
- /// returns the scroll delta in X direction
- virtual const float& get_x_delta () const =0;
-
- /// returns the scroll delta in Y direction
- virtual const float& get_y_delta () const =0;
-
- /// writes the X/Y scroll delta into it's parameters
- virtual void get_delta (float&, float&) const =0;
-
- virtual void update (float) =0;
-
-private:
- Scroller (const Scroller&);
- Scroller& operator= (const Scroller&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scroller_factory.cpp (from rev 2685,
branches/pingus_sdl/src/input/scroller_factory.cxx)
Deleted: branches/pingus_sdl/src/input/scroller_factory.cxx
===================================================================
--- branches/pingus_sdl/src/input/scroller_factory.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/scroller_factory.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,156 +0,0 @@
-// $Id: scroller_factory.cxx,v 1.12 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <stdlib.h>
-#include "../pingus_error.hxx"
-#include "axis.hxx"
-#include "axis_factory.hxx"
-#include "button.hxx"
-#include "button_factory.hxx"
-#include "pointer.hxx"
-#include "pointer_factory.hxx"
-#include "scroller_factory.hxx"
-#include "scrollers/axis_scroller.hxx"
-#include "scrollers/inverted_scroller.hxx"
-#include "scrollers/joystick_scroller.hxx"
-#include "scrollers/mouse_scroller.hxx"
-#include "scrollers/multiple_scroller.hxx"
-#include "scrollers/pointer_scroller.hxx"
-
-namespace Input {
-
-using namespace Scrollers;
-
-Scroller*
-ScrollerFactory::create(FileReader reader)
-{
- if (reader.get_name() == "axis-scroller")
- return axis_scroller(reader);
-
- else if (reader.get_name() == "inverted-scroller")
- return inverted_scroller(reader);
-
- else if (reader.get_name() == "joystick-scroller")
- return joystick_scroller(reader);
-
- else if (reader.get_name() == "mouse-scroller")
- return mouse_scroller(reader);
-
- else if (reader.get_name() == "multiple-scroller")
- return multiple_scroller(reader);
-
- else if (reader.get_name() == "pointer-scroller")
- return pointer_scroller(reader);
-
- else
- PingusError::raise(std::string("Unknown scroller type: ") +
reader.get_name());
-
- return 0; // never reached
-}
-
-Scroller*
-ScrollerFactory::axis_scroller (FileReader reader)
-{
- float speed;
- if (!reader.read_float("speed", speed))
- PingusError::raise("AxisScroller without speed parameter");
-
- std::vector<Axis*> axes;
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin() + 1;
- i != sections.end(); ++i)
- axes.push_back(AxisFactory::create(*i));
-
- return new AxisScroller(axes, speed);
-}
-
-Scroller*
-ScrollerFactory::inverted_scroller (FileReader reader)
-{
- bool invert_x;
- if (!reader.read_bool("invert-x", invert_x))
- PingusError::raise("InvertedScroller without invert X parameter");
-
- bool invert_y;
- if (!reader.read_bool("invert-y", invert_y))
- PingusError::raise("InvertedScroller without invert Y parameter");
-
- Scroller* scroller;
- scroller = create(reader);
-
- return new InvertedScroller(scroller, invert_x, invert_y);
-}
-
-Scroller*
-ScrollerFactory::joystick_scroller (FileReader reader)
-{
- int id;
- if (!reader.read_int("id", id))
- PingusError::raise("JoystickScroller without id parameter");
-
- float speed;
- if (!reader.read_float("speed", speed))
- PingusError::raise("JoystickScroller without speed parameter");
-
- return new JoystickScroller(id, speed);
-}
-
-Scroller*
-ScrollerFactory::mouse_scroller (FileReader reader)
-{
- int id = 0;
- reader.read_int("id", id);
- return new MouseScroller(id);
-}
-
-Scroller*
-ScrollerFactory::multiple_scroller (FileReader reader)
-{
- std::vector<Scroller*> scrollers;
-
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- {
- scrollers.push_back(create(*i));
- }
-
- return new MultipleScroller(scrollers);
-}
-
-Scroller*
-ScrollerFactory::pointer_scroller (FileReader reader)
-{
- Pointer* pointer;
- Button* button;
-
- const std::vector<FileReader>& sections = reader.get_sections();
-
- if (sections.size() != 2)
- PingusError::raise("ScrollerFactory isn't <pointer><button>");
-
- pointer = PointerFactory::create(sections[0]);
- button = ButtonFactory::create(sections[1]);
-
- return new PointerScroller(pointer, button);
-}
-
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scroller_factory.hpp (from rev 2685,
branches/pingus_sdl/src/input/scroller_factory.hxx)
Deleted: branches/pingus_sdl/src/input/scroller_factory.hxx
===================================================================
--- branches/pingus_sdl/src/input/scroller_factory.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/input/scroller_factory.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,52 +0,0 @@
-// $Id: scroller_factory.hxx,v 1.9 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_SCROLLER_FACTORY_HXX
-#define HEADER_PINGUS_INPUT_SCROLLER_FACTORY_HXX
-
-#include "../file_reader.hxx"
-
-namespace Input {
-
-class Scroller;
-
-class ScrollerFactory
-{
-private:
- static Scroller* axis_scroller (FileReader reader);
- static Scroller* inverted_scroller (FileReader reader);
- static Scroller* joystick_scroller (FileReader reader);
- static Scroller* mouse_scroller (FileReader reader);
- static Scroller* multiple_scroller (FileReader reader);
- static Scroller* pointer_scroller (FileReader reader);
-
-public:
- static Scroller* create (FileReader reader);
-
-private:
- ScrollerFactory ();
- ScrollerFactory (const ScrollerFactory&);
- ScrollerFactory& operator= (const ScrollerFactory&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scrollers/axis_scroller.cpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/axis_scroller.cxx)
Deleted: branches/pingus_sdl/src/input/scrollers/axis_scroller.cxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/axis_scroller.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/axis_scroller.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,84 +0,0 @@
-// $Id: axis_scroller.cxx,v 1.6 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <math.h>
-#include <assert.h>
-#include "../../debug.hxx"
-#include "../axis.hxx"
-#include "axis_scroller.hxx"
-
-namespace Input {
-namespace Scrollers {
-
-AxisScroller::AxisScroller (const std::vector<Axis*>& axes_, float speed_)
- : axes(axes_),
- speed(speed_),
- x_delta(0),
- y_delta(0)
-{
- assert(axes.size() > 1);
- assert(axes[0]->get_angle() != axes[1]->get_angle());
-}
-
-AxisScroller::~AxisScroller ()
-{
- for (unsigned int i=0; i < axes.size(); ++i)
- delete axes[i];
-}
-
-const float&
-AxisScroller::get_x_delta () const
-{
- return x_delta;
-}
-
-const float&
-AxisScroller::get_y_delta () const
-{
- return y_delta;
-}
-
-void
-AxisScroller::get_delta (float& x, float& y) const
-{
- x = x_delta;
- y = y_delta;
-}
-
-void
-AxisScroller::update (float delta)
-{
- x_delta = 0;
- y_delta = 0;
-
- for (std::vector<Axis*>::const_iterator it = axes.begin(); it != axes.end();
it++)
- {
- (*it)->update(delta);
-
- x_delta += (float)cos((*it)->get_angle() * 3.14159265 / 180) * speed *
delta * (*it)->get_pos();
- y_delta += (float)sin((*it)->get_angle() * 3.14159265 / 180) * speed *
delta * (*it)->get_pos();
- }
-
-}
-
-} // namespace Scrollers
-} // namespace Input
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/input/scrollers/axis_scroller.hpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/axis_scroller.hxx)
Deleted: branches/pingus_sdl/src/input/scrollers/axis_scroller.hxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/axis_scroller.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/axis_scroller.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,69 +0,0 @@
-// $Id: axis_scroller.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_AXIS_SCROLLER_HXX
-#define HEADER_PINGUS_INPUT_AXIS_SCROLLER_HXX
-
-#include <vector>
-#include "../scroller.hxx"
-
-namespace Input {
-
-class Axis;
-
-namespace Scrollers {
-
-/**
- @brief create a Scroller out of two or more axes
-
- XML definition: <axis-scroller speed="?"> <axis 1>...<axis N>
</axis-scroller>
-
- This class requires at least two axes whereby it's enforced that the first
- two have different angles.
-*/
-class AxisScroller : public Scroller {
-private:
- const std::vector<Axis*> axes;
-
- const float speed;
- float x_delta;
- float y_delta;
-
-public:
- AxisScroller (const std::vector<Axis*>& axes_, float speed_);
- ~AxisScroller ();
-
- const float& get_x_delta () const;
- const float& get_y_delta () const;
-
- void get_delta (float& x, float& y) const;
-
- void update (float delta);
-
-private:
- AxisScroller (const AxisScroller&);
- AxisScroller& operator= (const AxisScroller&);
-};
-
-} // namespace Scroller
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scrollers/dummy_scroller.hpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/dummy_scroller.hxx)
Deleted: branches/pingus_sdl/src/input/scrollers/dummy_scroller.hxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/dummy_scroller.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/dummy_scroller.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,58 +0,0 @@
-// $Id: dummy_scroller.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_DUMMY_SCROLLER_HXX
-#define HEADER_PINGUS_INPUT_DUMMY_SCROLLER_HXX
-
-#include "../scroller.hxx"
-
-namespace Input {
-namespace Scrollers {
-
-/**
- @brief dummy class to be used if an Scroller is required but none defined
-
- XML definition: none
-*/
-class DummyScroller : public Scroller {
-private:
- const float delta;
-
-public:
-
- DummyScroller () : delta(0) { }
-
- const float& get_x_delta () const { return delta; }
- const float& get_y_delta () const { return delta; }
-
- void get_delta (float& x_delta, float& y_delta) const { x_delta = delta;
y_delta = delta; }
-
- void update (float) { }
-
-private:
- DummyScroller (const DummyScroller&);
- DummyScroller& operator= (const DummyScroller&);
-};
-
-} // namespace Scrollers
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scrollers/inverted_scroller.cpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/inverted_scroller.cxx)
Deleted: branches/pingus_sdl/src/input/scrollers/inverted_scroller.cxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/inverted_scroller.cxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/inverted_scroller.cxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,68 +0,0 @@
-// $Id: inverted_scroller.cxx,v 1.3 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "inverted_scroller.hxx"
-
-namespace Input {
-namespace Scrollers {
-
-InvertedScroller::InvertedScroller (Scroller* scroller_, bool invert_x_, bool
invert_y_)
- : scroller(scroller_),
- invert_x(invert_x_),
- invert_y(invert_y_)
-{
-}
-
-InvertedScroller::~InvertedScroller ()
-{
- delete scroller;
-}
-
-const float&
-InvertedScroller::get_x_delta () const
-{
- return x_pos;
-}
-
-const float&
-InvertedScroller::get_y_delta () const
-{
- return y_pos;
-}
-
-void
-InvertedScroller::get_delta (float& x, float& y) const
-{
- x = x_pos;
- y = y_pos;
-}
-
-void
-InvertedScroller::update (float delta)
-{
- scroller->update(delta);
-
- (invert_x) ? x_pos = -(scroller->get_x_delta()) : x_pos =
scroller->get_x_delta();
- (invert_y) ? y_pos = -(scroller->get_y_delta()) : x_pos =
scroller->get_y_delta();
-}
-
-} // namespace Scroller
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scrollers/inverted_scroller.hpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/inverted_scroller.hxx)
Deleted: branches/pingus_sdl/src/input/scrollers/inverted_scroller.hxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/inverted_scroller.hxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/inverted_scroller.hxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,66 +0,0 @@
-// $Id: inverted_scroller.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_INVERTED_SCROLLER_HXX
-#define HEADER_PINGUS_INPUT_INVERTED_SCROLLER_HXX
-
-#include "../scroller.hxx"
-
-namespace Input {
-namespace Scrollers {
-
-/**
- @brief inverts the results of the contained scroller
-
- XML definition: <inverted-scroller invert-x="0/1" invert-y="0/1" speed="?">
<scroller> </inverted-scroller>
-
- Wheter the X and/or the Y axis shall be inverted must be specified
explizitly.
-*/
-class InvertedScroller : public Scroller {
-private:
- Scroller* const scroller;
-
- const bool invert_x;
- const bool invert_y;
-
- float x_pos;
- float y_pos;
-
-public:
- InvertedScroller (Scroller* scroller_, bool invert_x_, bool invert_y_);
- ~InvertedScroller ();
-
- const float& get_x_delta () const;
- const float& get_y_delta () const;
-
- void get_delta (float& x, float& y) const;
-
- void update (float delta);
-
-private:
- InvertedScroller (const InvertedScroller&);
- InvertedScroller& operator= (const InvertedScroller&);
-};
-
-} // namespace Scroller
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scrollers/joystick_scroller.cpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/joystick_scroller.cxx)
Deleted: branches/pingus_sdl/src/input/scrollers/joystick_scroller.cxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/joystick_scroller.cxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/joystick_scroller.cxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,74 +0,0 @@
-// $Id: joystick_scroller.cxx,v 1.4 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../axes/joystick_axis.hxx"
-#include "joystick_scroller.hxx"
-
-namespace Input {
-namespace Scrollers {
-
-JoystickScroller::JoystickScroller (int id_, float speed_)
- : id(id_),
- axis1(new Axes::JoystickAxis(id, 0, 0)),
- axis2(new Axes::JoystickAxis(id, 1, 90)),
- speed(speed_),
- x_delta(0),
- y_delta(0)
-{
-}
-
-JoystickScroller::~JoystickScroller ()
-{
- delete axis1;
- delete axis2;
-}
-
-const float&
-JoystickScroller::get_x_delta () const
-{
- return x_delta;
-}
-
-const float&
-JoystickScroller::get_y_delta () const
-{
- return y_delta;
-}
-
-void
-JoystickScroller::get_delta (float& x, float& y) const
-{
- x = x_delta;
- y = y_delta;
-}
-
-void
-JoystickScroller::update (float delta)
-{
- axis1->update(delta);
- axis2->update(delta);
-
- x_delta = axis1->get_pos() * speed;
- y_delta = axis2->get_pos() * speed;
-}
-
-} // namespace Scroller
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scrollers/joystick_scroller.hpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/joystick_scroller.hxx)
Deleted: branches/pingus_sdl/src/input/scrollers/joystick_scroller.hxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/joystick_scroller.hxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/joystick_scroller.hxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,69 +0,0 @@
-// $Id: joystick_scroller.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_JOYSTICK_SCROLLER_HXX
-#define HEADER_PINGUS_INPUT_JOYSTICK_SCROLLER_HXX
-
-#include "../scroller.hxx"
-
-namespace Input {
-
-class Axis;
-
-namespace Scrollers {
-
-/**
- @brief maps the first two axes of a joystick into a Scroller
-
- XML definition: <joystick-scroller id="joystick id" speed="?"/>
-*/
-class JoystickScroller : public Scroller {
-private:
- int id;
-
- Axis* const axis1;
- Axis* const axis2;
-
- const float speed;
-
- float x_delta;
- float y_delta;
-
-public:
- JoystickScroller (int id_, float speed_);
- ~JoystickScroller ();
-
- const float& get_x_delta () const;
- const float& get_y_delta () const;
-
- void get_delta (float& x, float& y) const;
-
- void update (float delta);
-
-private:
- JoystickScroller (const JoystickScroller&);
- JoystickScroller& operator= (const JoystickScroller&);
-};
-
-} // namespace Pointers
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scrollers/mouse_scroller.cpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/mouse_scroller.cxx)
Deleted: branches/pingus_sdl/src/input/scrollers/mouse_scroller.cxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/mouse_scroller.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/mouse_scroller.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,68 +0,0 @@
-// $Id: mouse_scroller.cxx,v 1.4 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <ClanLib/Display/mouse.h>
-#include <ClanLib/Core/System/error.h>
-#include "mouse_scroller.hxx"
-
-namespace Input {
-namespace Scrollers {
-
-MouseScroller::MouseScroller(int id) : old_x(0), old_y(0), x_delta(0),
y_delta(0)
-{
- if (id < 0 || id >= CL_Mouse::get_device_count())
- throw CL_Error("MouseScroller: id is outside of the range");
-
- device = CL_Mouse::get_device(id);
-}
-
-const float&
-MouseScroller::get_x_delta () const
-{
- return x_delta;
-}
-
-const float&
-MouseScroller::get_y_delta () const
-{
- return y_delta;
-}
-
-void
-MouseScroller::get_delta (float& x, float& y) const
-{
- x = x_delta;
- y = y_delta;
-}
-
-void
-MouseScroller::update (float)
-{
- x_delta = device.get_x() - old_x;
- y_delta = device.get_y() - old_y;
-
- old_x = (float)device.get_x();
- old_y = (float)device.get_y();
-}
-
-} // namespace Scroller
-} // namespace Input
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/input/scrollers/mouse_scroller.hpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/mouse_scroller.hxx)
Deleted: branches/pingus_sdl/src/input/scrollers/mouse_scroller.hxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/mouse_scroller.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/mouse_scroller.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,62 +0,0 @@
-// $Id: mouse_scroller.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_MOUSE_SCROLLER_HXX
-#define HEADER_PINGUS_INPUT_MOUSE_SCROLLER_HXX
-
-#include <ClanLib/Display/input_device.h>
-#include "../scroller.hxx"
-
-namespace Input {
-namespace Scrollers {
-
-/**
- @brief turns the mouse into a scroller
-
- XML definition: <mouse-scroller/>
-*/
-class MouseScroller : public Scroller {
-private:
- CL_InputDevice device;
- float old_x;
- float old_y;
- float x_delta;
- float y_delta;
-
-public:
- MouseScroller(int id);
-
- const float& get_x_delta () const;
- const float& get_y_delta () const;
-
- void get_delta (float& x, float& y) const;
-
- void update (float);
-
-private:
- MouseScroller (const MouseScroller&);
- MouseScroller& operator= (const MouseScroller&);
-};
-
-} // namespace Scrollers
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scrollers/multiple_scroller.cpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/multiple_scroller.cxx)
Deleted: branches/pingus_sdl/src/input/scrollers/multiple_scroller.cxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/multiple_scroller.cxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/multiple_scroller.cxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,73 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "multiple_scroller.hxx"
-
-namespace Input {
-namespace Scrollers {
-
-MultipleScroller::MultipleScroller (const std::vector<Scroller*>& scrollers_)
: scrollers(scrollers_)
-{
-}
-
-MultipleScroller::~MultipleScroller ()
-{
- for (std::vector<Scroller*>::const_iterator it = scrollers.begin(); it !=
scrollers.end(); it++)
- delete *it;
-}
-
-const float&
-MultipleScroller::get_x_delta () const
-{
- return x_pos;
-}
-
-const float&
-MultipleScroller::get_y_delta () const
-{
- return y_pos;
-}
-
-void
-MultipleScroller::get_delta (float& x, float& y) const
-{
- x = x_pos;
- y = y_pos;
-}
-
-void
-MultipleScroller::update (float delta)
-{
- bool found_delta = false;
-
- for (std::vector<Scroller*>::const_iterator it = scrollers.begin(); it !=
scrollers.end(); it++)
- {
- (*it)->update(delta);
-
- if (!found_delta && ((*it)->get_x_delta() || (*it)->get_y_delta()))
- {
- x_pos = (*it)->get_x_delta();
- y_pos = (*it)->get_y_delta();
- found_delta = true;
- }
- }
-}
-
-} // namespace Scroller
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scrollers/multiple_scroller.hpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/multiple_scroller.hxx)
Deleted: branches/pingus_sdl/src/input/scrollers/multiple_scroller.hxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/multiple_scroller.hxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/multiple_scroller.hxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,62 +0,0 @@
-// $Id: multiple_scroller.hxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_MULTIPLE_SCROLLER_HXX
-#define HEADER_PINGUS_INPUT_MULTIPLE_SCROLLER_HXX
-
-#include <vector>
-#include "../scroller.hxx"
-
-namespace Input {
-namespace Scrollers {
-
-/**
- @brief maps multiple Scrollers into one
-
- XML definition: <multiple-scroller> <scroller 1>...<scroller N>
</multiple-scroller>
-*/
-class MultipleScroller : public Scroller {
-private:
- std::vector<Scroller*> scrollers;
-
- float x_pos;
- float y_pos;
-
-public:
- MultipleScroller (const std::vector<Scroller*>& scrollers_);
- ~MultipleScroller ();
-
- const float& get_x_delta () const;
- const float& get_y_delta () const;
-
- void get_delta (float& x, float& y) const;
-
- void update (float delta);
-
-private:
- MultipleScroller (const MultipleScroller&);
- MultipleScroller& operator= (const MultipleScroller&);
-};
-
-} // namespace Scroller
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scrollers/pointer_scroller.cpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/pointer_scroller.cxx)
Deleted: branches/pingus_sdl/src/input/scrollers/pointer_scroller.cxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/pointer_scroller.cxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/pointer_scroller.cxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,93 +0,0 @@
-// $Id: pointer_scroller.cxx,v 1.5 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../button.hxx"
-#include "../pointer.hxx"
-#include "pointer_scroller.hxx"
-
-namespace Input {
-namespace Scrollers {
-
-PointerScroller::PointerScroller (Pointer* pointer_, Button* modifier_)
- : pointer(pointer_),
- modifier(modifier_),
- x_delta(0),
- y_delta(0),
- x_pos(-1),
- y_pos(-1)
-{
-}
-
-PointerScroller::~PointerScroller ()
-{
- delete pointer;
- delete modifier;
-}
-
-const float&
-PointerScroller::get_x_delta () const
-{
- return x_delta;
-}
-
-const float&
-PointerScroller::get_y_delta () const
-{
- return y_delta;
-}
-
-void
-PointerScroller::get_delta (float& x, float& y) const
-{
- x = x_delta;
- y = y_delta;
-}
-
-void
-PointerScroller::update (float delta)
-{
- pointer ->update(delta);
- modifier->update(delta);
-
- if (modifier->is_pressed())
- {
- if (x_pos == -1)
- {
- x_pos = pointer->get_x_pos();
- y_pos = pointer->get_y_pos();
- }
- else
- {
- x_delta = pointer->get_x_pos() - x_pos;
- y_delta = pointer->get_y_pos() - y_pos;
-
- pointer->set_pos(x_pos, y_pos);
- }
- }
- else
- {
- x_pos = -1;
- y_pos = -1;
- }
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
Copied: branches/pingus_sdl/src/input/scrollers/pointer_scroller.hpp (from rev
2685, branches/pingus_sdl/src/input/scrollers/pointer_scroller.hxx)
Deleted: branches/pingus_sdl/src/input/scrollers/pointer_scroller.hxx
===================================================================
--- branches/pingus_sdl/src/input/scrollers/pointer_scroller.hxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/input/scrollers/pointer_scroller.hxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,73 +0,0 @@
-// $Id: pointer_scroller.hxx,v 1.5 2003/10/20 13:33:44 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_POINTER_SCROLLER_HXX
-#define HEADER_PINGUS_INPUT_POINTER_SCROLLER_HXX
-
-#include "../scroller.hxx"
-
-namespace Input {
-
-class Button;
-class Pointer;
-
-namespace Scrollers {
-
-/**
- @brief allows a Pointer to be used as a Scroller
-
- XML definition: <pointer-scroller> <pointer><button> </pointer-scroller>
-
- A PointerScroller creates ScrollEvents whenever the associated Button is
pressed.
- The Pointer itself is then reset to it's original position to prevent the
visible
- pointer from moving while the Pointer is used as a Scroller.
-*/
-class PointerScroller : public Scroller {
-private:
- Pointer* const pointer;
- Button* const modifier;
-
- float x_delta;
- float y_delta;
- float x_pos;
- float y_pos;
-
-public:
-
- PointerScroller (Pointer* pointer_, Button* modifier_);
- ~PointerScroller ();
-
- const float& get_x_delta () const;
- const float& get_y_delta () const;
-
- void get_delta (float& x, float& y) const;
-
- void update (float delta);
-
-private:
- PointerScroller (const PointerScroller&);
- PointerScroller& operator= (const PointerScroller&);
-};
-
-} // namespace Pointer
-} // namespace Input
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/input_event.hpp (from rev 2685,
branches/pingus_sdl/src/input_event.hxx)
Deleted: branches/pingus_sdl/src/input_event.hxx
===================================================================
--- branches/pingus_sdl/src/input_event.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/input_event.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,84 +0,0 @@
-// $Id: input_event.hxx,v 1.10 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_EVENT_HXX
-#define HEADER_PINGUS_INPUT_EVENT_HXX
-
-#error "Don't used this the moment, its underdevelopment and not compilable"
-
-#include "pingus.hxx"
-#include "vector.hxx"
-
-
-/** This will need some^H^H^H^H a lot of work */
-typedef enum {
- /** Pointer Events (pos contains the move-delta) */
- MOUSE_MOVE,
-
- /** The scroll controll has been move, in theory this could be a
- second mouse, an second analog stick or a combination of button
- press and cursor movement */
- SCROLL_MOVE,
-
- /** The button that turns the MOUSE_MOVE into a SCROLL_MOVE */
- SCROLL_MODIFIER,
-
- /*** Generic button events (pos contains position) */
- PRIMARY_BUTTON_PRESSED,
- SECONDARY_BUTTON_PRESSED,
-
- /** Escape is pressed */
- ESCAPE_TRIGGERED,
-
- /** 'p' or 'Pause' got pressed */
- PAUSE_PRESSED,
- FASTFORWARD_TRIGGERED,
-
- /** Buttons for switching to the next/previous Action */
- ACTION_UP,
- ACTION_DOWN,
-
- /** Action selected, Most likly one of the F1-F?? buttons is
- pressed, this could also be a combination of shift-button or
- something else */
- ACTION_SELECTED
-
-} InputEventType;
-
-
-class InputEvent
-{
-public:
- /** Position or movement */
- Vector pos;
-
- /** integer data */
- int data;
-
- /** The type of event */
- EventType type;
-
- /** The 'owner' or player of this event */
- int owner;
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/layer_manager.cpp (from rev 2685,
branches/pingus_sdl/src/layer_manager.cxx)
Deleted: branches/pingus_sdl/src/layer_manager.cxx
===================================================================
--- branches/pingus_sdl/src/layer_manager.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/layer_manager.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,55 +0,0 @@
-// $Id: layer_manager.cxx,v 1.8 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "layer_manager.hxx"
-
-
-LayerManager::LayerManager ()
-{
-}
-
-LayerManager::~LayerManager()
-{
-}
-
-void
-LayerManager::add_layer(Sprite sprite, float x_o, float y_o, float x_u, float
y_u)
-{
- layers.push_back(Layer(sprite, x_o, y_o, x_u, y_u));
-}
-
-void
-LayerManager::draw (DrawingContext& gc)
-{
- for (std::vector<Layer>::iterator i = layers.begin ();
- i != layers.end (); ++i)
- i->draw(gc);
-}
-
-void
-LayerManager::update (float delta)
-{
- for (std::vector<Layer>::iterator i = layers.begin ();
- i != layers.end (); ++i)
- i->update(delta);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/layer_manager.hpp (from rev 2685,
branches/pingus_sdl/src/layer_manager.hxx)
Deleted: branches/pingus_sdl/src/layer_manager.hxx
===================================================================
--- branches/pingus_sdl/src/layer_manager.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/layer_manager.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,92 +0,0 @@
-// $Id: layer_manager.hxx,v 1.13 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_LAYER_MANAGER_HXX
-#define HEADER_PINGUS_LAYER_MANAGER_HXX
-
-#include "pingus.hxx"
-#include <cmath>
-#include "sprite.hpp"
-#include "gui/display.hxx"
-#include "display/drawing_context.hxx"
-
-
-class LayerManager
-{
-private:
- class Layer
- {
- private:
- Sprite sur;
-
- float x_pos;
- float y_pos;
-
- float x_update;
- float y_update;
-
- float x_offset;
- float y_offset;
-
- public:
- Layer ()
- : x_pos(0), y_pos(0),
- x_update(0), y_update(0),
- x_offset(0), y_offset(0)
- {}
-
- Layer (const Sprite& arg_sur, float x_o, float y_o, float x_u, float y_u)
- : sur(arg_sur),
- x_pos(0), y_pos(0),
- x_update(x_u), y_update(y_u),
- x_offset(x_o), y_offset(y_o)
- {}
-
- void draw (DrawingContext& gc)
- {
- gc.draw(sur, Vector3f(x_pos + x_offset, y_pos + y_offset));
- gc.draw(sur, Vector3f(x_pos + x_offset - gc.get_width(), y_pos +
y_offset));
- }
-
- void update (float delta)
- {
- x_pos = fmod((x_pos + x_update * delta),(float)Display::get_width());
- y_pos = fmod((y_pos + y_update * delta),(float)Display::get_height());
- }
- };
-
- std::vector<Layer> layers;
-
-public:
- LayerManager ();
- ~LayerManager();
-
- void add_layer (Sprite sur, float x_o, float y_o, float x_u, float y_u);
- void draw (DrawingContext& gc);
- void update (float delta);
-
-private:
- LayerManager (const LayerManager&);
- LayerManager& operator= (const LayerManager&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/math.hpp (from rev 2685,
branches/pingus_sdl/src/math.hxx)
Deleted: branches/pingus_sdl/src/math.hxx
===================================================================
--- branches/pingus_sdl/src/math.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/math.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,94 +0,0 @@
-// $Id: math.hxx,v 1.10 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_MATH_HXX
-#define HEADER_PINGUS_MATH_HXX
-
-#include <stdlib.h>
-#include "pingus.hxx"
-
-
-/** A collection of small math helper functions, some of them might be
- equal in functionality to standard STL functions, but provided
- here for portability and broken STL implementations
-
- @brief A collection of mathematical helper functions */
-namespace Math {
-
-const double pi = 3.14159265358979323846; /* pi */
-const double pi_2 = 1.57079632679489661923; /* pi/2 */
-
-// Win32 defines these are defines already, so we have to undef them
-#ifdef min
-#undef min
-#endif
-#ifdef max
-#undef max
-#endif
-
-template<class T>
-T min (const T& a, const T& b)
-{
- if (a < b)
- return a;
- else
- return b;
-}
-
-template<class T>
-T max (const T& a, const T& b)
-{
- if (a > b)
- return a;
- else
- return b;
-}
-
-template<class T>
-T mid (const T& a, const T& b, const T& c)
-{
- return max((a), min((b), (c)));
-}
-
-inline
-double frand()
-{
- return double(rand()) / (RAND_MAX+1.0);
-}
-
-inline
-bool rand_bool()
-{
- return rand()%2 == 0;
-}
-
-inline
-int round (float f)
-{
- if (f >= 0.0f)
- return int(f + 0.5f);
- else
- return int(f - 0.5f);
-}
-
-} // namespace Math
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/mover.cpp (from rev 2685,
branches/pingus_sdl/src/mover.cxx)
Deleted: branches/pingus_sdl/src/mover.cxx
===================================================================
--- branches/pingus_sdl/src/mover.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/mover.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,51 +0,0 @@
-// $Id: mover.cxx,v 1.3 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "mover.hxx"
-
-
-Mover::Mover(World* const world_arg, const Vector3f& pos_arg)
- : world(world_arg),
- pos(pos_arg),
- remaining_move(0.0f, 0.0f, 0.0f),
- collision(false)
-{
-}
-
-Mover::~Mover ()
-{
-}
-
-Vector3f Mover::get_pos() const
-{
- return pos;
-}
-
-Vector3f Mover::remaining() const
-{
- return remaining_move;
-}
-
-bool Mover::collided() const
-{
- return collision;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/mover.hpp (from rev 2685,
branches/pingus_sdl/src/mover.hxx)
Deleted: branches/pingus_sdl/src/mover.hxx
===================================================================
--- branches/pingus_sdl/src/mover.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/mover.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,66 +0,0 @@
-// $Id: mover.hxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_MOVER_HXX
-#define HEADER_PINGUS_MOVER_HXX
-
-#include "math/vector3f.hpp"
-
-class Collider;
-class World;
-
-class Mover
-{
- public:
- /** Constructor of abstract class */
- Mover(World* const world_arg, const Vector3f& pos_arg);
-
- /** Destructor of abstract class */
- virtual ~Mover() = 0;
-
- /** Updates the position of the object taking into account collisions */
- virtual void update(const Vector3f& move, const Collider& collider) = 0;
-
- /** Get the resulting position vector */
- Vector3f get_pos() const;
-
- /** Get the move vector remaining after a collision */
- Vector3f remaining() const;
-
- /** Get whether object stopped moving because it collided with something */
- bool collided() const;
-
- protected:
- /** World in which the object should move */
- World* const world;
-
- /** Position of the object to move */
- Vector3f pos;
-
- /** Move vector remaining after a collision */
- Vector3f remaining_move;
-
- /** Flag to denote whether object has had a collision */
- bool collision;
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/movers/linear_mover.cpp (from rev 2685,
branches/pingus_sdl/src/movers/linear_mover.cxx)
Deleted: branches/pingus_sdl/src/movers/linear_mover.cxx
===================================================================
--- branches/pingus_sdl/src/movers/linear_mover.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/movers/linear_mover.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,64 +0,0 @@
-// $Id: linear_mover.cxx,v 1.4 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "linear_mover.hxx"
-#include "../collider.hxx"
-
-namespace Movers {
-
-LinearMover::LinearMover(World* const world_arg, const Vector3f& pos_arg)
- : Mover(world_arg, pos_arg)
-{
-}
-
-LinearMover::~LinearMover()
-{
-}
-
-void LinearMover::update(const Vector3f& move, const Collider& collision_check)
-{
- Vector3f target_pos = pos + move;
- Vector3f step_vector = move;
-
- // Static cast to stop warning
- int move_length = static_cast<int>(move.length());
-
- // Make the step vector (i.e. change to a unit vector)
- step_vector.normalize();
-
- collision = false;
-
- // Move to the destination one unit vector at a time
- for (int i = 0; i < move_length && !collision; ++i)
- {
- collision = collision_check(world, pos, step_vector);
-
- pos += step_vector;
- }
-
- // If on a collision pixel, back away from it.
- if (collision)
- pos -= step_vector;
-
- remaining_move = target_pos - pos;
-}
-
-} // namespace Movers
-
-/* EOF */
Copied: branches/pingus_sdl/src/movers/linear_mover.hpp (from rev 2685,
branches/pingus_sdl/src/movers/linear_mover.hxx)
Deleted: branches/pingus_sdl/src/movers/linear_mover.hxx
===================================================================
--- branches/pingus_sdl/src/movers/linear_mover.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/movers/linear_mover.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,47 +0,0 @@
-// $Id: linear_mover.hxx,v 1.4 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_LINEAR_MOVER_HXX
-#define HEADER_PINGUS_LINEAR_MOVER_HXX
-
-#include "../mover.hxx"
-
-
-class Collider;
-
-namespace Movers {
-
-class LinearMover : public Mover
-{
- public:
- /** Constructor */
- LinearMover(World* const world_arg, const Vector3f& pos_arg);
-
- /** Destructor */
- ~LinearMover();
-
- /** Updates the position of the object taking into account collisions */
- void update(const Vector3f& move, const Collider& collision_at);
-};
-
-} // namespace Movers
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/multiline_text.cpp (from rev 2685,
branches/pingus_sdl/src/multiline_text.cxx)
Deleted: branches/pingus_sdl/src/multiline_text.cxx
===================================================================
--- branches/pingus_sdl/src/multiline_text.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/multiline_text.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,148 +0,0 @@
-// $Id: multiline_text.cxx,v 1.10 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include "font.hpp"
-#include "multiline_text.hxx"
-#include "math.hxx"
-
-
-MultiLineText::MultiLineText()
-{
- width = -1;
- height = -1;
-}
-
-void
-MultiLineText::set_font(Font f)
-{
- font = f;
-}
-
-void
-MultiLineText::set_text(const std::string& str, int text_width)
-{
-#ifdef CLANLIB_0_6
- int last_pos;
-
- assert(font);
-
- for(unsigned int j=0; j < str.length(); )
- {
- last_pos = str.length();
-
- for(unsigned int i=j; /* i < (text_width + j) */
- font->get_text_width(str.substr(j, i-j).c_str()) < text_width;
- ++i)
- {
- if (i >= str.length())
- {
- last_pos = str.length();
- break;
- }
- else if (str[i] == ' ')
- {
- last_pos = i;
- }
- else if (str[i] == '\n')
- {
- last_pos = i;
- break;
- }
- }
- text.push_back(str.substr(j, last_pos - j));
- j = last_pos + 1;
- }
-
- //cout << "MultiLineText: " << str << endl;
- /*
- cout << "MultiLineText: " << endl;
- for(std::vector<std::string>::iterator i = text.begin(); i != text.end();
++i)
- cout << " " << *i << endl;
- */
- width = 0;
- for(std::vector<std::string>::iterator i = text.begin(); i != text.end();
++i)
- width = Math::max(width, font->get_text_width(i->c_str()));
-
- height = text.size() * font->get_height();
-#endif
-}
-
-void
-MultiLineText::print_left(int x_pos, int y_pos)
-{
- int y_inc = 0;
-
- for(std::vector<std::string>::iterator i = text.begin();
- i != text.end();
- ++i)
- {
- font.draw(x_pos, y_pos + y_inc, i->c_str());
- y_inc += font.get_height();
- }
-}
-
-void
-MultiLineText::print_right(int x_pos, int y_pos)
-{
-#ifdef CLANLIB_0_6
- int y_inc = 0;
-
- for(std::vector<std::string>::iterator i = text.begin();
- i != text.end();
- ++i)
- {
- font->print_right(x_pos, y_pos + y_inc, i->c_str());
- y_inc += font->get_height();
- }
-#endif
-}
-
-void
-MultiLineText::print_center(int x_pos, int y_pos)
-{
- int y_inc = 0;
-
- Font myfont = font;
- myfont.set_alignment(origin_top_center);
-
- for(std::vector<std::string>::iterator i = text.begin();
- i != text.end();
- ++i)
- {
- myfont.draw(x_pos, y_pos + y_inc, i->c_str());
- y_inc += font.get_height();
- }
-}
-
-int
-MultiLineText::get_width()
-{
- return width;
-}
-
-int
-MultiLineText::get_height()
-{
- return height;
-}
-
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/multiline_text.hpp (from rev 2685,
branches/pingus_sdl/src/multiline_text.hxx)
Deleted: branches/pingus_sdl/src/multiline_text.hxx
===================================================================
--- branches/pingus_sdl/src/multiline_text.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/multiline_text.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,55 +0,0 @@
-// $Id: multiline_text.hxx,v 1.9 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_MULTILINE_TEXT_HXX
-#define HEADER_PINGUS_MULTILINE_TEXT_HXX
-
-#include "pingus.hxx"
-#include "font.hpp"
-#include <string>
-#include <vector>
-
-
-class MultiLineText
-{
-private:
- Font font;
- std::vector<std::string> text;
- int width, height;
-
-public:
- MultiLineText();
-
- void set_font(Font font);
- void set_text(const std::string&, int width);
- void print_left(int, int);
- void print_right(int, int);
- void print_center(int, int);
- int get_width();
- int get_height();
-
-private:
- MultiLineText (const MultiLineText&);
- MultiLineText& operator= (const MultiLineText&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/particles/explosive_particle.cpp (from rev
2685, branches/pingus_sdl/src/particles/explosive_particle.cxx)
Deleted: branches/pingus_sdl/src/particles/explosive_particle.cxx
===================================================================
--- branches/pingus_sdl/src/particles/explosive_particle.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/explosive_particle.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,96 +0,0 @@
-// $Id: explosive_particle.cxx,v 1.6 2003/04/19 10:23:19 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#if 0
-#include "../col_map.hxx"
-#include "../pingu_map.hxx"
-#include "../world.hxx"
-#include "../particles/particle_holder.hxx"
-#include "../resource.hxx"
-#include "explosive_particle.hxx"
-
-ExplosiveParticle::ExplosiveParticle (int x, int y, float x_a, float y_a)
- : Particle (x, y, x_a, y_a),
- alive (true)
-{
-}
-
-ExplosiveParticle::~ExplosiveParticle ()
-{
-}
-
-void
-ExplosiveParticle::update (float delta)
-{
- Vector new_pos = pos + velocity * delta;
-
- Vector incr = pos - new_pos;
- incr.normalize ();
-
- // FIXME: This thing needs to be more abstract, we just need it far
- // to often to reimplement it over and over again.
- while ( static_cast<int>(new_pos.x) != static_cast<int>(pos.x)
- || static_cast<int>(new_pos.y) != static_cast<int>(pos.y))
- {
- pos -= incr;
-
- if ( pos.x < 0
- || pos.y < 0
- || pos.x + 1 > WorldObj::get_world()->get_width ()
- || pos.y + 1 > WorldObj::get_world()->get_height())
- {
- alive = false;
- return;
- }
-
- if
(WorldObj::get_world()->get_colmap()->getpixel(static_cast<int>(pos.x),
static_cast<int>(pos.y)))
- {
- detonate();
- }
- }
-
- pos = new_pos;
-}
-
-void
-ExplosiveParticle::detonate ()
-{
- alive = false;
- WorldObj::get_world()->get_particle_holder ()->add_pingu_explo((int)pos.x,
(int)pos.y);
-
- CollisionMask mask = Resource::load_collision_mask("Other/bomber_radius",
"pingus");
- WorldObj::get_world()->remove(mask,
- int(pos.x) - (bomber_radius.get_width()/2),
- int(pos.y) - (bomber_radius.get_height()/2));
-}
-
-//void
-//ExplosiveParticle::draw_offset(int ofx, int ofy, float /*s*/)
-//{
-// sprite.put_screen (int(pos.x + ofx), int(pos.y + ofy));
-//}
-
-
-bool
-ExplosiveParticle::is_alive(void)
-{
- return alive;
-}
-
-/* EOF */
-#endif
Copied: branches/pingus_sdl/src/particles/explosive_particle.hpp (from rev
2685, branches/pingus_sdl/src/particles/explosive_particle.hxx)
Deleted: branches/pingus_sdl/src/particles/explosive_particle.hxx
===================================================================
--- branches/pingus_sdl/src/particles/explosive_particle.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/explosive_particle.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,52 +0,0 @@
-// $Id: explosive_particle.hxx,v 1.7 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#if 0
-#ifndef HEADER_PINGUS_PARTICLES_EXPLOSIVE_PARTICLE_HXX
-#define HEADER_PINGUS_PARTICLES_EXPLOSIVE_PARTICLE_HXX
-
-#include "../sprite.hxx"
-#include "particle.hxx"
-
-class ExplosiveParticle
- : public Particle
-{
-private:
- //Sprite sprite;
- bool alive;
-
-public:
- ExplosiveParticle (int x, int y, float x_a, float y_a);
- ~ExplosiveParticle ();
- ///
- void update(float delta);
- ///
- //void draw_offset(int ofx, int ofy, float s);
- ///
- bool is_alive(void);
- void detonate ();
-
-private:
- ExplosiveParticle (const ExplosiveParticle&);
- ExplosiveParticle& operator= (const ExplosiveParticle&);
-};
-
-#endif
-
-/* EOF */
-#endif
Copied: branches/pingus_sdl/src/particles/ground_particle.cpp (from rev 2685,
branches/pingus_sdl/src/particles/ground_particle.cxx)
Deleted: branches/pingus_sdl/src/particles/ground_particle.cxx
===================================================================
--- branches/pingus_sdl/src/particles/ground_particle.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/ground_particle.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,64 +0,0 @@
-// $Id: ground_particle.cxx,v 1.4 2003/04/19 10:23:19 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#if 0
-#include "../globals.hxx"
-#include "../resource.hxx"
-#include "ground_particle.hxx"
-
-GroundParticle::GroundParticle (int x, int y, float x_a, float y_a)
- : Particle (x,y, x_a, y_a)
-{
- surface = Resource::load_sprite("particles/ground");
- livetime = 25 + (rand() % 10);
- time = livetime;
-}
-
-void
-GroundParticle::update (float /*delta*/)
-{
- pos.x += velocity.x;
- pos.y += velocity.y;
- // y_add += 0.1;
-
- if (livetime > 0)
- --livetime;
-}
-
-void
-GroundParticle::draw_offset (int ofx, int ofy, float s)
-{
- if (fast_mode)
- return;
-
- if (s == 1.0) {
- // FIXME: This segfaults from time to time, don't know why
- surface.put_screen(static_cast<int>(pos.x + ofx - 16),
- static_cast<int>(pos.y + ofy - 16),
- 3 - (livetime * 4 / time));
- } else {
- int width = static_cast<int>(surface.get_width () * s);
- int height = static_cast<int>(surface.get_height() * s);
- surface.put_screen(static_cast<int>((pos.x + ofx) * s) - width / 2,
- static_cast<int>((pos.y + ofy) * s) - height / 2,
- width, height, 3 - (livetime * 4 / time));
- }
-}
-
-/* EOF */
-#endif
Copied: branches/pingus_sdl/src/particles/ground_particle.hpp (from rev 2685,
branches/pingus_sdl/src/particles/ground_particle.hxx)
Deleted: branches/pingus_sdl/src/particles/ground_particle.hxx
===================================================================
--- branches/pingus_sdl/src/particles/ground_particle.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/ground_particle.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,44 +0,0 @@
-// $Id: ground_particle.hxx,v 1.6 2003/04/19 10:23:19 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#if 0
-#ifndef HEADER_PINGUS_PARTICLES_GROUND_PARTICLE_HXX
-#define HEADER_PINGUS_PARTICLES_GROUND_PARTICLE_HXX
-
-#include "particle.hxx"
-
-///
-class GroundParticle : public Particle
-{
-private:
- int time;
-public:
- GroundParticle(int x, int y, float x_a, float y_a);
-
- void update(float delta);
- void draw_offset(int ofx, int ofy, float s);
-
-private:
- GroundParticle (const GroundParticle&);
- GroundParticle& operator= (const GroundParticle&);
-};
-
-#endif
-
-/* EOF */
-#endif
Copied: branches/pingus_sdl/src/particles/pingu_particle_holder.cpp (from rev
2685, branches/pingus_sdl/src/particles/pingu_particle_holder.cxx)
Deleted: branches/pingus_sdl/src/particles/pingu_particle_holder.cxx
===================================================================
--- branches/pingus_sdl/src/particles/pingu_particle_holder.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/pingu_particle_holder.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,169 +0,0 @@
-// $Id: pingu_particle_holder.cxx,v 1.10 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/scene_context.hxx"
-#include "../math.hxx"
-#include "../col_map.hxx"
-#include "../resource.hxx"
-#include "../world.hxx"
-#include "pingu_particle_holder.hxx"
-
-namespace Particles {
-
-const float x_collision_decrease = 0.3f;
-const float y_collision_decrease = 0.6f;
-
-PinguParticleHolder::PinguParticle::PinguParticle (int x, int y)
- : livetime(50 + (rand() % 75)),
- use_frame2((rand() % 5) == 0),
- pos(Vector3f(x, y)),
- velocity(Vector3f((float)Math::frand() * 7 - 3.5, (float)Math::frand() *
-9))
-{
-}
-
-
-PinguParticleHolder::PinguParticleHolder ()
- : surface(Resource::load_sprite("particles/pingu_explo"))
-{
-}
-
-
-void
-PinguParticleHolder::add_particle (int x, int y)
-{
- int i = 0;
-
- // fill gaps from dead entries
- for (std::vector<PinguParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- {
- if (!it->livetime)
- {
- *it = PinguParticle(x, y);
- ++i;
- }
- }
-
- // allocate space for all remaining particles at once
- particles.reserve(particles.size() + 50 - i);
-
- // create remaining entries
- for (; i < 50; ++i)
- particles.push_back(PinguParticle(x, y));
-}
-
-void
-PinguParticleHolder::update ()
-{
- // update all contained particles
- for (std::vector<PinguParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- {
- // skip dead particles
- if (!it->livetime)
- continue;
-
- float tmp_x_add = 0.0f;
- float tmp_y_add = 0.0f;
-
- // Simulated gravity
- it->velocity.y += WorldObj::get_world()->get_gravity();
-
- if (it->velocity.y > 0)
- {
- for (tmp_y_add = it->velocity.y; tmp_y_add >= 1.0; --tmp_y_add)
- {
- if (world->get_colmap()->getpixel(static_cast<int>(it->pos.x),
static_cast<int>(it->pos.y)))
- {
- it->velocity.y *= -y_collision_decrease;
- tmp_y_add = -tmp_y_add;
- --it->pos.y;
- break;
- }
- ++it->pos.y;
- }
- it->pos.y += tmp_y_add;
- }
- else
- {
- for (tmp_y_add = it->velocity.y; tmp_y_add <= -1.0; ++tmp_y_add)
- {
- if (world->get_colmap()->getpixel(static_cast<int>(it->pos.x),
static_cast<int>(it->pos.y)))
- {
- it->velocity.y *= -y_collision_decrease;
- tmp_y_add = -tmp_y_add;
- ++it->pos.y;
- break;
- }
- --it->pos.y;
- }
- it->pos.y += tmp_y_add;
- }
-
-
- if (it->velocity.x > 0)
- {
- for (tmp_x_add = it->velocity.x; tmp_x_add >= 1.0; --tmp_x_add)
- {
- if (world->get_colmap()->getpixel(static_cast<int>(it->pos.x),
static_cast<int>(it->pos.y)))
- {
- it->velocity.x *= -x_collision_decrease;
- tmp_x_add = -tmp_x_add;
- --it->pos.x;
- break;
- }
- ++it->pos.x;
- }
- it->pos.x += tmp_x_add;
- }
- else
- {
- for (tmp_x_add = it->velocity.x; tmp_x_add <= -1.0; ++tmp_x_add)
- {
- if (world->get_colmap()->getpixel(static_cast<int>(it->pos.x),
static_cast<int>(it->pos.y)))
- {
- it->velocity.x *= -x_collision_decrease;
- tmp_x_add = -tmp_x_add;
- ++it->pos.x;
- break;
- }
- --it->pos.x;
- }
- it->pos.x += tmp_x_add;
- }
-
- --it->livetime;
- }
-}
-
-
-void
-PinguParticleHolder::draw (SceneContext& gc)
-{
- for (std::vector<PinguParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- {
- // skip dead particles
- if (!it->livetime)
- continue;
-
- gc.color().draw(surface, it->pos);
- }
-}
-
-} // namespace Particles
-
-/* EOF */
Copied: branches/pingus_sdl/src/particles/pingu_particle_holder.hpp (from rev
2685, branches/pingus_sdl/src/particles/pingu_particle_holder.hxx)
Deleted: branches/pingus_sdl/src/particles/pingu_particle_holder.hxx
===================================================================
--- branches/pingus_sdl/src/particles/pingu_particle_holder.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/pingu_particle_holder.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,73 +0,0 @@
-// $Id: pingu_particle_holder.hxx,v 1.6 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PARTICLES_PINGU_PARTICLE_HOLDER_HXX
-#define HEADER_PINGUS_PARTICLES_PINGU_PARTICLE_HOLDER_HXX
-
-#include <vector>
-#include "../sprite.hpp"
-#include "../math/vector3f.hpp"
-#include "../worldobj.hxx"
-
-
-class SceneContext;
-
-namespace Particles {
-
-class PinguParticleHolder : public WorldObj
-{
- struct PinguParticle {
- int livetime;
- bool use_frame2;
- /// The current position of the particle
- Vector3f pos;
-
- /// The velocity of the particle
- Vector3f velocity;
-
- PinguParticle (int x, int y);
- };
-
-private:
- Sprite surface;
- std::vector<PinguParticle> particles;
-
-public:
- PinguParticleHolder ();
-
- void add_particle (int x, int y);
-
- float get_z_pos () const { return 1000.0f; }
-
- /// Let the particle move
- void update ();
-
- /// Draw the particle with the correct zoom resize
- void draw (SceneContext& gc);
-
-private:
- PinguParticleHolder (const PinguParticleHolder&);
- PinguParticleHolder& operator= (const PinguParticleHolder&);
-};
-
-} // namespace Particles
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/particles/rain_particle_holder.cpp (from rev
2685, branches/pingus_sdl/src/particles/rain_particle_holder.cxx)
Deleted: branches/pingus_sdl/src/particles/rain_particle_holder.cxx
===================================================================
--- branches/pingus_sdl/src/particles/rain_particle_holder.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/rain_particle_holder.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,130 +0,0 @@
-// $Id: rain_particle_holder.cxx,v 1.7 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/scene_context.hxx"
-#include "../math.hxx"
-#include "../col_map.hxx"
-#include "../globals.hxx"
-#include "../resource.hxx"
-#include "../world.hxx"
-#include "rain_particle_holder.hxx"
-
-namespace Particles {
-
-RainParticleHolder::RainParticle::RainParticle(int x, int y)
- : alive(true), splash(false), use_rain2_surf(false), splash_counter(0),
splash_frame(0), pos(Vector3f(x, y))
-{
- use_rain2_surf = ((rand() % 3) == 0);
- pos.z = 1.0 + (float)Math::frand() * 3.0;
-}
-
-
-RainParticleHolder::RainParticleHolder ()
- : rain1_surf (Resource::load_sprite("particles/rain1")),
- rain2_surf (Resource::load_sprite("particles/rain2")),
- rain_splash(Resource::load_sprite("particles/rain_splash"))
-{
-}
-
-
-void
-RainParticleHolder::add_particle (int x, int y)
-{
- // search for dead entry to replace
- for (std::vector<RainParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- if (!it->alive)
- {
- *it = RainParticle(x, y);
- return;
- }
-
- // create new entry
- particles.push_back(RainParticle(x, y));
-}
-
-void
-RainParticleHolder::update ()
-{
- // update all contained particles
- for (std::vector<RainParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- {
- // skip dead particles
- if (!it->alive)
- continue;
-
- if (it->splash)
- {
- if (it->splash_frame >= rain_splash.get_frame_count())
- {
- it->alive = false;
- continue;
- }
-
- it->splash_frame += 10 * game_speed / 1000.0f;
- (it->splash_counter == 3) ? it->alive = false :
++it->splash_counter;
- }
- else
- {
- if ( world->get_colmap()->getpixel(static_cast<int>(it->pos.x),
static_cast<int>(it->pos.y)) != Groundtype::GP_NOTHING
- && world->get_colmap()->getpixel(static_cast<int>(it->pos.x),
static_cast<int>(it->pos.y)) != Groundtype::GP_OUTOFSCREEN
- && ((rand() % 2) == 0))
- {
- it->splash = true;
- }
- else
- {
- if (it->pos.y > world->get_height())
- {
- it->alive = false;
- continue;
- }
-
- it->pos.x -= 5 * it->pos.z;
- it->pos.y += 16 * it->pos.z;
- }
- }
- }
-
-}
-
-
-void
-RainParticleHolder::draw (SceneContext& gc)
-{
-#ifdef CLANLIB_0_6
- for (std::vector<RainParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- {
- // skip dead/invisible particles
- if (!it->alive || it->pos.x > WorldObj::get_world()->get_width())
- continue;
-
- if (it->splash)
- gc.color().draw(rain_splash, it->pos,
static_cast<int>(it->splash_frame));
- else
- if (it->use_rain2_surf)
- gc.color().draw(rain2_surf, static_cast<int>(it->pos.x),
static_cast<int>(it->pos.y - rain1_surf.get_height()));
- else
- gc.color().draw(rain1_surf, static_cast<int>(it->pos.x),
static_cast<int>(it->pos.y - rain1_surf.get_height()));
- }
-#endif
-}
-
-} // namespace Particles
-
-/* EOF */
Copied: branches/pingus_sdl/src/particles/rain_particle_holder.hpp (from rev
2685, branches/pingus_sdl/src/particles/rain_particle_holder.hxx)
Deleted: branches/pingus_sdl/src/particles/rain_particle_holder.hxx
===================================================================
--- branches/pingus_sdl/src/particles/rain_particle_holder.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/rain_particle_holder.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,77 +0,0 @@
-// $Id: rain_particle_holder.hxx,v 1.7 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PARTICLES_RAIN_PARTICLE_HOLDER_HXX
-#define HEADER_PINGUS_PARTICLES_RAIN_PARTICLE_HOLDER_HXX
-
-#include <vector>
-#include "../sprite.hpp"
-#include "../math/vector3f.hpp"
-#include "../worldobj.hxx"
-
-
-class GraphicContext;
-
-namespace Particles {
-
-class RainParticleHolder : public WorldObj
-{
- struct RainParticle {
- bool alive;
- bool splash;
- bool use_rain2_surf;
- int splash_counter;
- float splash_frame;
-
- // pos.z contains a modificator for x and y pos
- Vector3f pos;
-
- RainParticle(int x, int y);
- };
-
-private:
- Sprite rain1_surf;
- Sprite rain2_surf;
- Sprite rain_splash;
-
- std::vector<RainParticle> particles;
-
-public:
- RainParticleHolder ();
-
- void add_particle(int x, int y);
-
- float get_z_pos () const { return 1000.0f; }
-
- /// Let the particle move
- void update ();
-
- /// Draw the particle with the correct zoom resize
- void draw (SceneContext& gc);
-
-private:
- RainParticleHolder (const RainParticleHolder&);
- RainParticleHolder& operator= (const RainParticleHolder&);
-};
-
-} // namespace Particles
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/particles/smoke_particle_holder.cpp (from rev
2685, branches/pingus_sdl/src/particles/smoke_particle_holder.cxx)
Deleted: branches/pingus_sdl/src/particles/smoke_particle_holder.cxx
===================================================================
--- branches/pingus_sdl/src/particles/smoke_particle_holder.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/smoke_particle_holder.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,92 +0,0 @@
-// $Id: smoke_particle_holder.cxx,v 1.6 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../globals.hxx"
-#include "../display/scene_context.hxx"
-#include "../resource.hxx"
-#include "smoke_particle_holder.hxx"
-
-namespace Particles {
-
-SmokeParticleHolder::SmokeParticle::SmokeParticle (float x, float y, float
vel_x, float vel_y)
- : pos(Vector3f(x,y)), velocity(Vector3f(vel_x, vel_y))
-{
- time = livetime = 25 + (rand() % 10);
- use_surf2 = rand() % 2;
-}
-
-
-SmokeParticleHolder::SmokeParticleHolder ()
- : surf1(Resource::load_sprite("pingus/particles/smoke")),
- surf2(Resource::load_sprite("pingus/particles/smoke2"))
-{
-}
-
-
-void
-SmokeParticleHolder::add_particle (float x, float y, float vel_x, float vel_y)
-{
- // search for dead entry to replace
- for (std::vector<SmokeParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- if (!it->livetime)
- {
- *it = SmokeParticle(x, y, vel_x, vel_y);
- return;
- }
-
- // create new entry
- particles.push_back(SmokeParticle(x, y, vel_x, vel_y));
-}
-
-void
-SmokeParticleHolder::update ()
-{
- // update all contained particles
- for (std::vector<SmokeParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- {
- // skip dead particles
- if (!it->livetime)
- continue;
-
- it->pos.x += it->velocity.x;
- it->pos.y += it->velocity.y;
-
- --it->livetime;
- }
-}
-
-
-void
-SmokeParticleHolder::draw (SceneContext& gc)
-{
- for (std::vector<SmokeParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- {
- if (!it->livetime)
- continue;
-
- if (!it->use_surf2)
- gc.color().draw(surf1, it->pos);
- else
- gc.color().draw(surf2, it->pos);
- }
-}
-
-} // namespace Particles
-
-/* EOF */
Copied: branches/pingus_sdl/src/particles/smoke_particle_holder.hpp (from rev
2685, branches/pingus_sdl/src/particles/smoke_particle_holder.hxx)
Deleted: branches/pingus_sdl/src/particles/smoke_particle_holder.hxx
===================================================================
--- branches/pingus_sdl/src/particles/smoke_particle_holder.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/smoke_particle_holder.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,73 +0,0 @@
-// $Id: smoke_particle_holder.hxx,v 1.5 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PARTICLES_SMOKE_PARTICLE_HOLDER_HXX
-#define HEADER_PINGUS_PARTICLES_SMOKE_PARTICLE_HOLDER_HXX
-
-#include <vector>
-#include "../sprite.hpp"
-#include "../math/vector3f.hpp"
-#include "../worldobj.hxx"
-
-
-class SceneContext;
-
-namespace Particles {
-
-class SmokeParticleHolder : public WorldObj
-{
- struct SmokeParticle {
- int time;
- int livetime;
- bool use_surf2;
- Vector3f pos;
- Vector3f velocity;
-
- SmokeParticle(float x, float y, float vel_x, float vel_y);
- };
-
-private:
- Sprite surf1;
- Sprite surf2;
-
- std::vector<SmokeParticle> particles;
-
-public:
- SmokeParticleHolder ();
-
- void add_particle (float x, float y, float vel_x, float vel_y);
-
- float get_z_pos () const { return 1000.0f; }
-
- /// Let the particle move
- void update ();
-
- /// Draw the particle with the correct zoom resize
- void draw (SceneContext& gc);
-
-private:
- SmokeParticleHolder (const SmokeParticleHolder&);
- SmokeParticleHolder& operator= (const SmokeParticleHolder&);
-};
-
-} // namespace Particles
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/particles/snow_particle_holder.cpp (from rev
2685, branches/pingus_sdl/src/particles/snow_particle_holder.cxx)
Deleted: branches/pingus_sdl/src/particles/snow_particle_holder.cxx
===================================================================
--- branches/pingus_sdl/src/particles/snow_particle_holder.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/snow_particle_holder.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,155 +0,0 @@
-// $Id: snow_particle_holder.cxx,v 1.9 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include "../math.hxx"
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../ground_map.hxx"
-#include "../resource.hxx"
-#include "../world.hxx"
-#include "snow_particle_holder.hxx"
-
-namespace Particles {
-
-SnowParticleHolder::SnowParticle::SnowParticle (int x, int y, bool colliding_)
- : alive(true),
- colliding(colliding_),
- pos(Vector3f(x,y)),
- velocity(Vector3f(0.0f, 1 + ((float)Math::frand() * 3.5f)))
-{
- switch (rand() % 10)
- {
- case 0:
- type = SnowParticleHolder::Snow1;
- break;
- case 1:
- type = SnowParticleHolder::Snow2;
- break;
- case 2:
- case 3:
- type = SnowParticleHolder::Snow3;
- break;
- case 5:
- case 6:
- type = SnowParticleHolder::Snow4;
- default:
- type = SnowParticleHolder::Snow5;
- break;
- }
-}
-
-
-SnowParticleHolder::SnowParticleHolder ()
- : snow1 (Resource::load_sprite("particles/snow1")),
- snow2 (Resource::load_sprite("particles/snow2")),
- snow3 (Resource::load_sprite("particles/snow3")),
- snow4 (Resource::load_sprite("particles/snow4")),
- snow5 (Resource::load_sprite("particles/snow5")),
- ground(Resource::load_sprite("particles/ground_snow"))
-{
-}
-
-
-void
-SnowParticleHolder::add_particle (int x, int y, bool colliding)
-{
- // search for dead entry to replace
- for (std::vector<SnowParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- if (!it->alive)
- {
- *it = SnowParticle(x, y, colliding);
- return;
- }
-
- // create new entry
- particles.push_back(SnowParticle(x, y, colliding));
-}
-
-void
-SnowParticleHolder::update ()
-{
- // update all contained particles
- for (std::vector<SnowParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- {
- // skip dead particles
- if (!it->alive)
- continue;
- it->pos.x += it->velocity.x;
- it->pos.y += it->velocity.y;
-
- if (it->pos.y > world->get_height())
- {
- it->alive = false;
- continue;
- }
-
- it->velocity.x += ((float)Math::frand() - 0.5f) / 10;
-#ifdef CLANLIB_0_6
- if (it->colliding)
- {
- int pixel =
world->get_colmap()->getpixel(static_cast<int>(it->pos.x),
static_cast<int>(it->pos.y));
- if ( pixel != Groundtype::GP_NOTHING
- && pixel != Groundtype::GP_WATER
- && pixel != Groundtype::GP_OUTOFSCREEN)
- {
- world->put(ground, static_cast<int>(it->pos.x - 1),
static_cast<int>(it->pos.y - 1));
- it->alive = false;
- }
- }
-#endif
- }
-
-}
-
-
-void
-SnowParticleHolder::draw (SceneContext& gc)
-{
- for (std::vector<SnowParticle>::iterator it=particles.begin(); it !=
particles.end(); ++it)
- {
- if (!it->alive)
- continue;
-
- switch (it->type)
- {
- case Snow1:
- gc.color().draw(snow1, it->pos);
- break;
- case Snow2:
- gc.color().draw(snow2, it->pos);
- break;
- case Snow3:
- gc.color().draw(snow3, it->pos);
- break;
- case Snow4:
- gc.color().draw(snow4, it->pos);
- break;
- case Snow5:
- gc.color().draw(snow5, it->pos);
- break;
- default:
- assert(!"Invalid Snow-Type");
- }
- }
-}
-
-} // namespace Particles
-
-/* EOF */
Copied: branches/pingus_sdl/src/particles/snow_particle_holder.hpp (from rev
2685, branches/pingus_sdl/src/particles/snow_particle_holder.hxx)
Deleted: branches/pingus_sdl/src/particles/snow_particle_holder.hxx
===================================================================
--- branches/pingus_sdl/src/particles/snow_particle_holder.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/particles/snow_particle_holder.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,82 +0,0 @@
-// $Id: snow_particle_holder.hxx,v 1.5 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PARTICLES_SNOW_PARTICLE_HOLDER_HXX
-#define HEADER_PINGUS_PARTICLES_SNOW_PARTICLE_HOLDER_HXX
-
-#include <vector>
-#include "../sprite.hpp"
-#include "../math/vector3f.hpp"
-#include "../worldobj.hxx"
-
-
-class SceneContext;
-
-namespace Particles {
-
-class SnowParticleHolder : public WorldObj
-{
-private:
- enum ParticleType { Snow1, Snow2, Snow3, Snow4, Snow5 };
-
- struct SnowParticle {
- bool alive;
- bool colliding;
- ParticleType type;
- Vector3f pos;
- Vector3f velocity;
-
- SnowParticle(int x, int y, bool colliding_);
- };
-
-friend struct SnowParticle;
-
-private:
- Sprite snow1;
- Sprite snow2;
- Sprite snow3;
- Sprite snow4;
- Sprite snow5;
- Sprite ground;
-
- std::vector<SnowParticle> particles;
-
-public:
- SnowParticleHolder ();
-
- void add_particle (int x, int y, bool colliding = false);
-
- float get_z_pos () const { return 1000.0f; }
-
- /// Let the particle move
- void update ();
-
- /// Draw the particle with the correct zoom resize
- void draw (SceneContext& gc);
-
-private:
- SnowParticleHolder (const SnowParticleHolder&);
- SnowParticleHolder& operator= (const SnowParticleHolder&);
-};
-
-} //namespace Particles
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/path_manager.cpp (from rev 2685,
branches/pingus_sdl/src/path_manager.cxx)
Deleted: branches/pingus_sdl/src/path_manager.cxx
===================================================================
--- branches/pingus_sdl/src/path_manager.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/path_manager.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,112 +0,0 @@
-// $Id: path_manager.cxx,v 1.7 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "globals.hxx"
-#include "system.hxx"
-#include "path_manager.hxx"
-#include "debug.hxx"
-
-
-PathManager path_manager;
-
-PathManager::PathManager ()
- : path_found (false)
-{
-}
-
-PathManager::~PathManager ()
-{
-}
-
-void
-PathManager::add_path (const std::string& path)
-{
- pout(PINGUS_DEBUG_PATHMGR) << "PathManager: add_path: " << path << std::endl;
- path_list.push_back (path);
-}
-
-std::string
-PathManager::complete (const std::string& relative_path)
-{
- return relative_path;
-#if 0
- std::string comp_path = base_path + "/" + relative_path;
- pout(PINGUS_DEBUG_PATHMGR) << "PathManager: " << relative_path << " -> " <<
comp_path << std::endl;
-
- return comp_path;
-#endif
-}
-
-bool
-PathManager::find_path (const std::list<std::string>& file_list)
-{
- for (PathIter i = path_list.begin (); !path_found && i != path_list.end ();
++i)
- {
- bool found_file = true;
- for (PathIter f = file_list.begin (); found_file && f != file_list.end
(); ++f)
- {
- if (!System::exist(*i + "/" + *f))
- found_file = false;
- }
- if (found_file)
- {
- path_found = true;
- base_path = *i;
-
- pout(PINGUS_DEBUG_PATHMGR) << "PathManager: Using base_path: " <<
base_path << std::endl;
-
- return true;
- }
- }
-
- pout(PINGUS_DEBUG_PATHMGR) << "PathManager: No base path found" << std::endl;
-
- return false;
-}
-
-/** Search for a path which contains the file 'file' */
-bool
-PathManager::find_path (const std::string& file)
-{
- for (PathIter i = path_list.begin (); !path_found && i != path_list.end ();
++i)
- {
- if (System::exist(*i + "/" + file))
- {
- path_found = true;
- base_path = *i;
-
- pout(PINGUS_DEBUG_PATHMGR) << "PathManager: Using base_path: " <<
base_path << std::endl;
-
- return true;
- }
- }
-
- pout(PINGUS_DEBUG_PATHMGR) << "PathManager: No base path found" << std::endl;
-
- return false;
-}
-
-void
-PathManager::set_path (const std::string& path)
-{
- base_path = path;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/path_manager.hpp (from rev 2685,
branches/pingus_sdl/src/path_manager.hxx)
Deleted: branches/pingus_sdl/src/path_manager.hxx
===================================================================
--- branches/pingus_sdl/src/path_manager.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/path_manager.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,70 +0,0 @@
-// $Id: path_manager.hxx,v 1.7 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PATH_MANAGER_HXX
-#define HEADER_PINGUS_PATH_MANAGER_HXX
-
-#include "pingus.hxx"
-#include <string>
-#include <list>
-
-
-class PathManager
-{
-private:
- std::list<std::string> path_list;
- typedef std::list<std::string>::const_iterator PathIter;
-
- bool path_found;
- std::string base_path;
-public:
- PathManager ();
- ~PathManager ();
-
- /** Search for a path which contains all the files given in
- file_list */
- bool find_path (const std::list<std::string>& file_list);
-
- /** Search for a path which contains the file 'file' */
- bool find_path (const std::string& file);
-
- /** Set the path directly without using find_path/add_path
- Must include trailing slash */
- void set_path (const std::string& path);
-
- /** Add a path to the search list */
- void add_path (const std::string& path);
-
- std::string get_base_path () { return base_path; }
-
- /** Complete a releative path to the absolute path, the returned
- path contains a trailing slash */
- std::string complete (const std::string& relative_path);
-
-private:
- PathManager (const PathManager&);
- PathManager& operator= (const PathManager&);
-};
-
-extern PathManager path_manager;
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingu.cpp (from rev 2685,
branches/pingus_sdl/src/pingu.cxx)
Deleted: branches/pingus_sdl/src/pingu.cxx
===================================================================
--- branches/pingus_sdl/src/pingu.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/pingu.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,448 +0,0 @@
-// $Id: pingu.cxx,v 1.45 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <sstream>
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include "globals.hxx"
-#include "world.hxx"
-#include "sound/sound.hxx"
-#include "col_map.hxx"
-#include "pingu_action.hxx"
-#include "pingu_action_factory.hxx"
-#include "gettext.h"
-#include "debug.hxx"
-#include "display/scene_context.hxx"
-#include "worldobj.hxx"
-#include "resource.hxx"
-#include "fonts.hxx"
-
-
-using namespace Actions;
-
-// Init a pingu at the given position while falling
-Pingu::Pingu (int arg_id, const Vector3f& arg_pos, int owner)
- : action(0),
- countdown_action (0),
- wall_action(0),
- fall_action(0),
- previous_action(Actions::Faller),
- id(arg_id),
- action_time(-1),
- owner_id(owner),
- status(PS_ALIVE),
- pos_x(arg_pos.x),
- pos_y(arg_pos.y),
- velocity(new Vector3f(0, 0, 0))
-{
- direction.left ();
-
- // Initialisize the action, after this step the action ptr will
- // always be valid in the pingu class
- action = PinguActionFactory::instance()->create(this, Faller);
-}
-
-Pingu::~Pingu ()
-{
- delete velocity;
-}
-
-unsigned int
-Pingu::get_id ()
-{
- return id;
-}
-
-bool
-Pingu::change_allowed (ActionName new_action)
-{
- assert (action);
- return action->change_allowed (new_action);
-}
-
-void
-Pingu::set_x (float x)
-{
- //std::cout << "Pingu::set_x (" << x << ")" << std::endl;
- pos_x = x;
-}
-
-void
-Pingu::set_y (float y)
-{
- //std::cout << "Pingu::set_y (" << y << ")" << std::endl;
- pos_y = y;
-}
-
-void
-Pingu::set_pos (float x, float y)
-{
- set_x (x);
- set_y (y);
-}
-
-void
-Pingu::set_pos (const Vector3f& arg_pos)
-{
- set_x (arg_pos.x);
- set_y (arg_pos.y);
-}
-
-void
-Pingu::set_velocity (const Vector3f& velocity_)
-{
- *velocity = velocity_;
-}
-
-// Set the action of the pingu (bridger, blocker, bomber, etc.)
-// This function is used by external stuff, like the ButtonPanel, etc
-// When you select a function on the button panel and click on a
-// pingu, this action will be called with the action name
-bool
-Pingu::request_set_action (PinguAction* act)
-{
- bool ret_val = false;
- assert(act);
-
- if (status == PS_DEAD)
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Setting action to a dead pingu" <<
std::endl;
- ret_val = false;
- }
- else
- {
- switch (act->get_activation_mode()) {
-
- case INSTANT:
-
- if (act->get_type() == action->get_type())
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Pingu: Already have action" <<
std::endl;
- ret_val = false;
- }
- else if (action->change_allowed(act->get_type()))
- {
- pout(PINGUS_DEBUG_ACTIONS) << "setting instant action" << std::endl;
- set_action(act);
- ret_val = true;
- }
- else
- {
- pout(PINGUS_DEBUG_ACTIONS) << "change from action " <<
action->get_name () << " not allowed" << std::endl;
- ret_val = false;
- }
- break;
-
- case WALL_TRIGGERED:
-
- if (wall_action && wall_action->get_type() == act->get_type())
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Not using wall action, we have
already" << std::endl;
- ret_val = false;
- }
- else
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Setting wall action" << std::endl;
- wall_action = act;
- ret_val = true;
- }
- break;
-
- case FALL_TRIGGERED:
-
- if (fall_action && fall_action->get_type() == act->get_type())
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Not using fall action, we have
already" << std::endl;
- ret_val = false;
- }
- else
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Setting fall action" << std::endl;
- fall_action = act;
- ret_val = true;
- }
- break;
-
- case COUNTDOWN_TRIGGERED:
-
- if (countdown_action && countdown_action->get_type() == act->get_type())
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Not using countdown action, we have
already" << std::endl;
- ret_val = false;
- break;
- }
-
- pout(PINGUS_DEBUG_ACTIONS) << "Setting countdown action" << std::endl;
- // We set the action and start the countdown
- action_time = act->activation_time();
- countdown_action = act;
- ret_val = true;
- break;
-
- default:
- pout(PINGUS_DEBUG_ACTIONS) << "unknown action activation_mode" <<
std::endl;
- ret_val = false;
- assert(0);
- break;
- }
- }
-
- if (ret_val) // Action successfull applied
- {
- act->on_successfull_apply();
- }
- else // Action failed to be set
- {
- act->on_failed_apply(this);
- }
-
- return ret_val;
-}
-
-bool
-Pingu::request_set_action (ActionName action_name)
-{
- return request_set_action (PinguActionFactory::instance ()->create (this,
action_name));
-}
-
-void
-Pingu::set_action (ActionName action_name)
-{
- set_action(PinguActionFactory::instance()->create(this, action_name));
-}
-
-// Sets an action without any checking
-void
-Pingu::set_action (PinguAction* act)
-{
- assert(act);
-
- previous_action = action->get_type();
-
- action = act;
-}
-
-bool
-Pingu::request_fall_action ()
-{
- if (fall_action)
- {
- set_action(fall_action);
- return true;
- }
-
- return false;
-}
-
-bool
-Pingu::request_wall_action ()
-{
- if (wall_action)
- {
- set_action(wall_action);
- return true;
- }
-
- return false;
-}
-
-PinguStatus
-Pingu::get_status (void) const
-{
- return status;
-}
-
-PinguStatus
-Pingu::set_status (PinguStatus s)
-{
- return (status = s);
-}
-
-// Returns true if the given koordinates are above the pingu
-bool
-Pingu::is_over (int x, int y)
-{
- Vector3f center = get_center_pos ();
-
- return (center.x + 16 > x && center.x - 16 < x &&
- center.y + 16 > y && center.y - 16 < y);
-}
-
-bool
-Pingu::is_inside (int x1, int y1, int x2, int y2)
-{
- assert (x1 < x2);
- assert (y1 < y2);
-
- return (pos_x > x1 && pos_x < x2
- &&
- pos_y > y1 && pos_y < y2);
-}
-
-// Returns the distance between the Pingu and a given coordinate
-double
-Pingu::dist (int x, int y)
-{
- Vector3f p = get_center_pos ();
-
- return sqrt(((p.x - x) * (p.x - x) + (p.y - y) * (p.y - y)));
-}
-
-// Let the pingu do his job (i.e. walk his way)
-void
-Pingu::update ()
-{
- if (status == PS_DEAD)
- return;
-
- // FIXME: Out of screen check is ugly
- /** The Pingu has hit the edge of the screen, a good time to let him
- die. */
- if (rel_getpixel(0, -1) == Groundtype::GP_OUTOFSCREEN)
- {
- //Sound::PingusSound::play_sound("die");
- status = PS_DEAD;
- return;
- }
-
- // if an countdown action is set, update the countdown time
- if (action_time > -1)
- --action_time;
-
- if (action_time == 0 && countdown_action)
- {
- set_action(countdown_action);
- // Reset the countdown action handlers
- countdown_action = 0;
- action_time = -1;
- return;
- }
-
- action->update();
-}
-
-// Draws the pingu on the screen with the given offset
-void
-Pingu::draw(SceneContext& gc)
-{
- char str[16];
-
- action->draw(gc);
-
- if (action_time != -1)
- {
- // FIXME: some people preffer a 5-0 or a 9-0 countdown, not sure
- // FIXME: about that got used to the 50-0 countdown [counting is
- // FIXME: in ticks, should probally be in seconds]
- snprintf(str, 16, "%d", action_time/3);
-
- gc.color().print_center(Fonts::lcd, pos_x, pos_y - 45 + 2, str);
- }
-}
-
-int
-Pingu::rel_getpixel (int x, int y)
-{
- return WorldObj::get_world()->get_colmap()->getpixel(static_cast<int>(pos_x
+ (x * direction)),
- static_cast<int>(pos_y
- y));
-}
-
-void
-Pingu::catch_pingu (Pingu* pingu)
-{
- action->catch_pingu(pingu);
-}
-
-bool
-Pingu::need_catch ()
-{
- if (status == PS_DEAD || status == PS_EXITED)
- return false;
-
- return action->need_catch();
-}
-
-void
-Pingu::set_direction (Direction d)
-{
- direction = d;
-}
-
-bool
-Pingu::is_alive (void)
-{
- return (status != PS_DEAD && status != PS_EXITED);
-}
-
-std::string
-Pingu::get_name()
-{
- return action->get_name();
-}
-
-Actions::ActionName
-Pingu::get_action ()
-{
- return action->get_type();
-}
-
-void
-Pingu::apply_force (Vector3f arg_v)
-{
- *velocity += arg_v;
- // Moving the pingu on pixel up, so that the force can take effect
- // FIXME: this should be handled by a state-machine
- --pos_y;
-}
-
-Vector3f
-Pingu::get_pos () const
-{
- return Vector3f(pos_x, pos_y, 0);
-}
-
-Vector3f
-Pingu::get_center_pos () const
-{
- return Vector3f(pos_x, pos_y) + Vector3f(0, -16);
-}
-
-int
-Pingu::get_owner ()
-{
- return owner_id;
-}
-
-std::string
-Pingu::get_owner_str ()
-{
- std::ostringstream ostr;
- ostr << owner_id;
- return ostr.str();
-}
-
-bool
-Pingu::catchable ()
-{
- return action->catchable ();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingu.hpp (from rev 2685,
branches/pingus_sdl/src/pingu.hxx)
Deleted: branches/pingus_sdl/src/pingu.hxx
===================================================================
--- branches/pingus_sdl/src/pingu.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/pingu.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,224 +0,0 @@
-// $Id: pingu.hxx,v 1.26 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PINGU_HXX
-#define HEADER_PINGUS_PINGU_HXX
-
-#include "direction.hxx"
-#include "pingu_enums.hxx"
-
-// Forward declarations
-class Vector3f;
-class ActionHolder;
-class PinguAction;
-class SceneContext;
-
-/** The class for managing one of the many penguins which are walking
- around in the World. All actions are handled by PinguAction
- objects. */
-class Pingu
-{
-private:
- /** The primary action with is currently in use */
- PinguAction* action;
-
- /** A secondary action which will turn active after a given amount of time
- The only example is currently the bomber. */
- PinguAction* countdown_action;
-
- /** the action that gets triggered when the pingu hits a wall */
- PinguAction* wall_action;
-
- /** the action that gets triggered when the pingu falls */
- PinguAction* fall_action;
-
- /** The previous_action contains the action type that was in action
- before action got applied, its here to enable action to behave
- differently depending on the previous action */
- Actions::ActionName previous_action;
-
- /** The uniq id of the Pingu, this is used to refer to the Pingu in
- a demo file or in a network connection */
- unsigned int id;
-
- int action_time;
- int owner_id;
-
- /// The stat of the pingu, these can be modified by PinguActions
- PinguStatus status;
-
- float pos_x;
- float pos_y;
-
- Vector3f* const velocity;
-
- bool request_set_action (PinguAction*);
- void set_action (PinguAction*);
-
-public:
-
- //FIXME make me private
- Direction direction;
-
- /** Creates a new Pingu at the given coordinates
- @param arg_id The uniq id of the pingu
- @param pos The start position of the pingu
- @param owner The owner id of the pingu (used for multiplayer) */
- Pingu (int arg_id, const Vector3f& pos, int owner);
-
- /** Destruct the pingu... */
- ~Pingu ();
-
- /** Return the logical pingus position, this is the position which
- is used for collision detection to the ground (the pingus
- feet) */
- Vector3f get_pos () const;
-
- /** Returns the visible position of the pingu, the graphical center
- of the pingu. */
- Vector3f get_center_pos () const;
-
- /** Returns the x position of the pingu
- * For backward comp. only
- */
- const float& get_x () const { return pos_x; }
-
- /** Returns the y position of the pingu
- For backward comp. only */
- const float& get_y () const { return pos_y; }
-
- /** Checks if this action allows to be overwritten with the given new action
*/
- bool change_allowed (Actions::ActionName new_action);
-
- /// Check if the pingu is still alive
- bool is_alive (void);
-
- /// Return the status of the pingu
- PinguStatus get_status (void) const;
-
- PinguStatus set_status (PinguStatus);
-
- /** The descriptive name of the action, this is used in the
- CaputreRectangle, so it can contain more than just the name
- (number of blocks, etc.) */
- std::string get_name();
-
- /// Returns the unique id of the pingu
- unsigned int get_id (void);
-
- /// Set the pingu to the given coordinates
- void set_pos (float x, float y);
-
- void set_x (float x);
-
- void set_y (float y);
-
- /// Set the pingu to the given coordinates
- void set_pos (const Vector3f& arg_pos);
-
- const Vector3f& get_velocity () const { return *velocity; }
-
- void set_velocity (const Vector3f& velocity_);
-
- // Set the pingu in the gives direction
- void set_direction (Direction d);
-
- /** Request an action to be set to the pingu, if its a persistent
- action, it will be hold back for later execution, same with a
- timed action, normal action will be applied if the current
- action allows that. */
- bool request_set_action (Actions::ActionName action_name);
-
- /** Set an action without any checking, the action will take
- instantly control. */
- void set_action (Actions::ActionName action_name);
-
- /// set the wall action if we have one
- bool request_wall_action ();
-
- /// set the fall action if we have one
- bool request_fall_action ();
-
- PinguAction* get_wall_action () { return wall_action; }
-
- PinguAction* get_fall_action () { return fall_action; }
-
- /** Returns the `color' of the colmap in the walking direction
- Examples:
- (0, -1) is the pixel under the pingu
- (1, 0) is the pixel in front of the pingu
- */
- int rel_getpixel (int x, int y);
-
- /** Let the pingu catch another pingu, so that an action can be
- applied (i.e. let a blocker change the direction f another
- pingu) */
- void catch_pingu (Pingu* pingu);
-
- /** Returns true if the pingu needs to catch another pingu */
- bool need_catch ();
-
- void draw (SceneContext& gc);
- void apply_force (Vector3f);
-
- void update();
-
- /** Indicate if the pingu's speed is above the deadly velocity */
- //bool is_tumbling () const;
-
- float get_z_pos () const { return 0; }
-
- /** @return The owner_id of the owner, only used in multiplayer
- configurations, ought to be 0 in single player */
- int get_owner ();
-
- /** @return The owner_id as a string. Only used in multiplayer
- configurations, ought to be "0" in single player */
- std::string get_owner_str ();
-
- bool is_over (int x, int y);
-
- bool is_inside (int x1, int y1, int x2, int y2);
-
- double dist (int x, int y);
-
- /** Return true if the pingu can be catched with the mouse and
- another action can be applied, false otherwise (exiter,
- splashed, etc.) */
- bool catchable ();
-
- /** @return the name of the action the Pingu currently has */
- Actions::ActionName get_action ();
-
- /** @return the action that was active before the action returned by
- get_action() took place. This is used in a few situations where
- an action needs to now what the Pingu was doing before the
- action took place (faller->bomber translation is different
- walker->bomber, etc.). */
- Actions::ActionName get_previous_action() const { return previous_action; }
-
-private:
- Pingu (const Pingu&);
- Pingu& operator= (const Pingu&);
-};
-
-
-#endif /* PINGU_HH */
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingu_action.cpp (from rev 2685,
branches/pingus_sdl/src/pingu_action.cxx)
Deleted: branches/pingus_sdl/src/pingu_action.cxx
===================================================================
--- branches/pingus_sdl/src/pingu_action.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingu_action.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,281 +0,0 @@
-// $Id: pingu_action.cxx,v 1.27 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include <math.h>
-#include "math/vector3f.hpp"
-#include "col_map.hxx"
-#include "world.hxx"
-#include "pingu.hxx"
-#include "pingu_action.hxx"
-#include "worldobj.hxx"
-
-
-PinguAction::PinguAction (Pingu* p)
- : pingu (p)
-{
-}
-
-PinguAction::~PinguAction ()
-{
-}
-
-// Checks if the pingu action needs to catch another pingu (needed for
-// example by the blocker)
-bool
-PinguAction::need_catch ()
-{
- return false;
-}
-
-// Wrapper around the colmap, to get the pixels infront of the pingu,
-// from is current position
-int
-PinguAction::rel_getpixel (int x, int y)
-{
- // FIXME: Inline me
- return
WorldObj::get_world()->get_colmap()->getpixel(static_cast<int>(pingu->get_x() +
(x * pingu->direction)),
-
static_cast<int>(pingu->get_y() - y));
-}
-
-ActionType
-PinguAction::get_activation_mode () const
-{
- return INSTANT;
-}
-
-char
-PinguAction::get_persistent_char ()
-{
- assert(!"This is not a persitent action!");
- return '-';
-}
-
-bool
-PinguAction::head_collision_on_walk (int x, int y)
-{
- int pixel = rel_getpixel(x, y + pingu_height);
-
- if (pixel != Groundtype::GP_NOTHING && !(pixel & Groundtype::GP_BRIDGE))
- return true;
-
- return false;
-}
-
-bool
-PinguAction::collision_on_walk (int x, int y)
-{
- bool collision = false;
- int pixel = Groundtype::GP_NOTHING;
-
- for (int pingu_y = 0; pingu_y <= pingu_height; ++pingu_y)
- {
- pixel = rel_getpixel(x, y + pingu_y);
-
- if (pixel != Groundtype::GP_NOTHING && pixel != Groundtype::GP_BRIDGE)
- {
- collision = true;
- break;
- }
- }
-
- return collision;
-}
-
-std::string
-PinguAction::get_name () const
-{
- return Actions::action_to_screenname(get_type());
-}
-
-void
-PinguAction::move_with_forces ()
-{
- // Apply gravity
- pingu->set_velocity(pingu->get_velocity() + Vector3f(0.0f, 1.0f));
-
-#if 0 // New Code
- Vector3f pos = pingu->get_pos();
- Vector3f target_pos = pos + pingu->get_velocity();
- Vector3f dir = target_pos - pingu->get_pos();
- Vector3f velocity = pingu->get_velocity();
-
- float length = dir.length();
- dir.normalize();
-
- for(float i = 0; i < length; ++i)
- {
- pingu->set_pos(pos + (dir * i));
-
- // If there is something below the Pingu
- if (rel_getpixel(0, -1) != Groundtype::GP_NOTHING)
- {
- // FIXME: this shouldn't be really here, but its a
- // FIXME: quick&dirty way to kill falling pingus
- if (velocity.y > Actions::Faller::deadly_velocity+1)
- {
- //std::cout << "Velocity: " << velocity << std::endl;
- pingu->set_action(Actions::Splashed);
- return;
- }
- else
- {
- // Make it so that the Pingu won't go down any further.
- pingu->set_velocity(Vector3f(0, 0));
- return;
- }
- }
- else if (head_collision_on_walk(0, 1))
- {
- return;
- }
- else if (collision_on_walk(1, 0))
- {
- // Make the Pingu bounce off the wall
- velocity.x = -velocity.x / 3.0f;
- pingu->set_velocity(velocity);
- pingu->direction.change();
- return;
- }
- }
-#else // Old Code
-
- // FIXME: What does this variable do?
- Vector3f resultant_force = pingu->get_velocity();
-
- // FIXME: and what is this all about?! Can't we just use floats?
- // Strictly speaking x_numerator should be initialised with
- // (resultant_force.y / 2) and y_numerator with (resultant_force.x / 2).
- // This would make the algorithm essentially match the Mid-Point Line
- // Algorithm. However, zero should do and is more comprehendable.
- int x_numerator = 0;
- int y_numerator = 0;
- int denominator = 0;
- int x_inc = 0;
- int y_inc = 0;
-
- if (fabs(resultant_force.x) > fabs(resultant_force.y))
- {
- // Initialise so that we move in whole pixels in x direction and
- // 'fractions' of a pixel in y direction.
- denominator = static_cast<int>(fabs(resultant_force.x));
- x_inc = denominator;
- y_inc = static_cast<int>(fabs(resultant_force.y));
- }
- else
- {
- // Initialise so that we move in whole pixels in y direction and
- // 'fractions' of a pixel in x direction.
- denominator = static_cast<int>(fabs(resultant_force.y));
- x_inc = static_cast<int>(fabs(resultant_force.x));
- y_inc = denominator;
- }
-
- Vector3f force_counter = resultant_force;
-
- // Keep moving the Pingu until there is only a fraction left
- while ( force_counter.x <= -1
- || force_counter.x >= 1
- || force_counter.y <= -1
- || force_counter.y >= 1)
- {
- x_numerator += x_inc;
-
- // Is it now not a fraction?
- if (x_numerator >= denominator)
- {
- // Revert back to being a fraction
- x_numerator -= denominator;
-
- // If there is something to the left of the Pingu
- if (collision_on_walk(1, 0))
- {
- // Make the Pingu reflect off the wall
- force_counter.x = -(force_counter.x);
- resultant_force.x = -(resultant_force.x/3);
-
- pingu->set_velocity(resultant_force);
-
- pingu->direction.change();
- }
- else
- {
- // Move the Pingu left
- pingu->set_x(pingu->get_x() + pingu->direction);
- force_counter.x -= pingu->direction;
- }
- }
-
- y_numerator += y_inc;
-
- // Is it now not a fraction?
- if (y_numerator >= denominator)
- {
- // Revert back to being a fraction
- y_numerator -= denominator;
-
- // Move the Pingu depending on what the direction of the force is
- if (force_counter.y >= 1)
- {
- // If there is something below the Pingu
- if (rel_getpixel(0, -1) != Groundtype::GP_NOTHING)
- {
- // FIXME: this shouldn't be really here, but its a
- // FIXME: quick&dirty way to kill falling pingus
- if (resultant_force.y >= deadly_velocity)
- {
- pingu->set_action(Actions::Splashed);
- return;
- }
- // Make it so that the Pingu won't go down any further.
- pingu->set_velocity(Vector3f(0, 0));
- return;
- }
- else
- {
- // Move the Pingu down
- pingu->set_y(pingu->get_y() + 1);
- force_counter.y--;
- }
- }
- else if (force_counter.y <= -1)
- {
- // If there is something in the way above the Pingu
- if (head_collision_on_walk(0, 1))
- {
- // Make it so that the Pingu won't go up any further.
- force_counter.y = 0;
- resultant_force.y = 0;
-
- pingu->set_velocity(resultant_force);
- }
- else
- {
- // Move the Pingu up
- pingu->set_y(pingu->get_y() - 1);
- force_counter.y++;
- }
- }
- }
- }
-#endif
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingu_action.hpp (from rev 2685,
branches/pingus_sdl/src/pingu_action.hxx)
Deleted: branches/pingus_sdl/src/pingu_action.hxx
===================================================================
--- branches/pingus_sdl/src/pingu_action.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingu_action.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,125 +0,0 @@
-// $Id: pingu_action.hxx,v 1.28 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PINGU_ACTION_HXX
-#define HEADER_PINGUS_PINGU_ACTION_HXX
-
-#include "pingu_enums.hxx"
-#include "pixel_buffer.hpp"
-#include "collision_mask.hpp"
-
-class ActionHolder;
-class SceneContext;
-class Pingu;
-
-enum ActionType
-{
- INSTANT,
- WALL_TRIGGERED,
- FALL_TRIGGERED,
- COUNTDOWN_TRIGGERED
-};
-
-/** This class provides an abstract interface for pingu actions. It is
- used to inherit classes which represent the actions. The actions
- are stored in a seperate library, have a look in actions/ for some
- examples. */
-class PinguAction
-{
-protected:
- /** A pointer to the pingu, which hold the action. */
- Pingu* pingu;
-
-public:
- PinguAction(Pingu* p);
- virtual ~PinguAction();
-
- /// Gives the PinguAction class access to the data of the Pingu.
- void set_pingu (Pingu*);
-
- /** Get the pixel from the colmap, relative to the pingu position.
-
- @param x x is relative to the direction, so 1 is the pixel
- infront of the pingu
-
- @param y 1 is up, -1 is down
- */
- int rel_getpixel (int x, int y);
-
- /** Checks if this action allows to be overwritten with the given new action
*/
- virtual bool change_allowed (Actions::ActionName) { return true; }
-
- /// The "AI" of the pingu.
- virtual void update () = 0;
-
- /** Draws the action */
- virtual void draw (SceneContext& gc) =0;
-
- /// Returns the activation mode
- virtual ActionType get_activation_mode (void) const;
-
- /** The name of the action, this is used in the CaputreRectangle, so
- it can contain more than just the name */
- virtual std::string get_name () const;
-
- /// The type of the action
- virtual Actions::ActionName get_type () const =0;
-
- /** Return the character that is shown when a persitent action is
- activated in the CaptureRectangle. */
- virtual char get_persistent_char ();
-
- /// Catch another pingu and act on it (see blocker.hxx)
- virtual bool need_catch();
-
- ///
- virtual void catch_pingu (Pingu*) { /* do nothing */}
-
- /// The time the action needs to get activated (see bomber.cxx)
- virtual int activation_time () { return -1; };
-
- /** Return true if the pingu can be catched with the mouse and
- another action can be applied, false otherwise (exiter,
- splashed, etc.) */
- virtual bool catchable () { return true; }
-
- /// True if Pingu in specified position would bang its head if it were
walking
- bool head_collision_on_walk (int x, int y);
-
- /// True if Pingu in specified position would have a collision if it were
walking
- bool collision_on_walk (int x, int y);
-
- /** Called if the action was successfully applied via request_set_action */
- virtual void on_successfull_apply () { }
-
- /** Called if the request_set_action failded to apply this action */
- virtual void on_failed_apply (Pingu*) { }
-
- /** Move Pingu according to the forces applied to it */
- void move_with_forces ();
-
-private:
- PinguAction (const PinguAction&);
- PinguAction& operator= (const PinguAction&);
-};
-
-
-#endif /* PINGU_ACTION_HH */
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingu_action_factory.cpp (from rev 2685,
branches/pingus_sdl/src/pingu_action_factory.cxx)
Deleted: branches/pingus_sdl/src/pingu_action_factory.cxx
===================================================================
--- branches/pingus_sdl/src/pingu_action_factory.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/pingu_action_factory.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,197 +0,0 @@
-// $Id: pingu_action_factory.cxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "pingus_error.hxx"
-
-#include "actions/rocket_launcher.hxx"
-#include "actions/boarder.hxx"
-#include "actions/superman.hxx"
-#include "actions/angel.hxx"
-#include "actions/basher.hxx"
-#include "actions/blocker.hxx"
-#include "actions/bomber.hxx"
-#include "actions/bridger.hxx"
-#include "actions/climber.hxx"
-#include "actions/digger.hxx"
-#include "actions/floater.hxx"
-#include "actions/miner.hxx"
-#include "actions/jumper.hxx"
-#include "actions/slider.hxx"
-#include "actions/teleported.hxx"
-#include "actions/exiter.hxx"
-#include "actions/smashed.hxx"
-#include "actions/laser_kill.hxx"
-#include "actions/splashed.hxx"
-#include "actions/waiter.hxx"
-#include "actions/drown.hxx"
-#include "actions/faller.hxx"
-#include "actions/walker.hxx"
-
-#include "pingu_action_factory.hxx"
-
-
-using namespace Actions;
-
-PinguActionFactory* PinguActionFactory::instance_ = 0;
-
-class PinguActionAbstractFactory
-{
-public:
- PinguActionAbstractFactory (Actions::ActionName id) {
- PinguActionFactory::instance ()-> register_factory (id, this);
- }
- virtual ~PinguActionAbstractFactory() {}
-
- virtual PinguAction* create (Pingu* p) =0;
-
-private:
- PinguActionAbstractFactory (const PinguActionAbstractFactory&);
- PinguActionAbstractFactory& operator= (const PinguActionAbstractFactory&);
-};
-
-template<class T>
-class PinguActionFactoryImpl : public PinguActionAbstractFactory
-{
-public:
- PinguActionFactoryImpl (Actions::ActionName id)
- : PinguActionAbstractFactory (id)
- {
- }
-
- PinguAction* create (Pingu* p) {
- return new T (p);
- }
-
-private:
- PinguActionFactoryImpl (const PinguActionFactoryImpl&);
- PinguActionFactoryImpl& operator= (const PinguActionFactoryImpl&);
-};
-
-PinguActionFactory::PinguActionFactory ()
-{
-}
-
-PinguActionFactory::~PinguActionFactory ()
-{
- delete_actions ();
-
- // Delete the action factories
- for (std::map<Actions::ActionName, PinguActionAbstractFactory*>::iterator i
= factories.begin();
- i != factories.end();
- ++i)
- {
- delete i->second;
- }
- factories.clear();
-}
-
-PinguActionFactory*
-PinguActionFactory::instance ()
-{
- if ( ! instance_)
- {
- instance_ = new PinguActionFactory ();
- instance_->register_core_actions ();
- }
- return instance_;
-}
-
-void
-PinguActionFactory::init()
-{
- instance_ = 0;
-}
-
-void
-PinguActionFactory::deinit()
-{
- delete instance_;
- instance_ = 0;
-}
-
-void
-PinguActionFactory::register_core_actions ()
-{
- new PinguActionFactoryImpl<class Angel> (Angel);
- new PinguActionFactoryImpl<class Basher> (Basher);
- new PinguActionFactoryImpl<class Blocker> (Blocker);
- new PinguActionFactoryImpl<class Boarder> (Boarder);
- new PinguActionFactoryImpl<class Bomber> (Bomber);
- new PinguActionFactoryImpl<class Bridger> (Bridger);
- new PinguActionFactoryImpl<class Climber> (Climber);
- new PinguActionFactoryImpl<class Digger> (Digger);
- new PinguActionFactoryImpl<class Drown> (Drown);
- new PinguActionFactoryImpl<class Exiter> (Exiter);
- new PinguActionFactoryImpl<class Faller> (Faller);
- new PinguActionFactoryImpl<class Floater> (Floater);
- new PinguActionFactoryImpl<class Jumper> (Jumper);
- new PinguActionFactoryImpl<class LaserKill> (Laserkill);
- new PinguActionFactoryImpl<class Miner> (Miner);
- new PinguActionFactoryImpl<class RocketLauncher> (Rocketlauncher);
- new PinguActionFactoryImpl<class Slider> (Slider);
- new PinguActionFactoryImpl<class Smashed> (Smashed);
- new PinguActionFactoryImpl<class Splashed> (Splashed);
- new PinguActionFactoryImpl<class Superman> (Superman);
- new PinguActionFactoryImpl<class Teleported> (Teleported);
- new PinguActionFactoryImpl<class Waiter> (Waiter);
- new PinguActionFactoryImpl<class Walker> (Walker);
-}
-
-PinguAction*
-PinguActionFactory::create (Pingu* pingu, ActionName id)
-{
- //std::cout << "PinguActionFactory: number of actions: " <<
all_actions.size() << std::endl;
- std::map<ActionName, PinguActionAbstractFactory*>::iterator it =
factories.find(id);
-
- if (it == factories.end())
- PingusError::raise("PinguActionFactory: Invalid id: " + id);
- else
- {
- PinguAction* action = it->second->create (pingu);
- all_actions.push_back (action);
- return action;
- }
-
- return 0; // never reached
-}
-
-void
-PinguActionFactory::delete_actions ()
-{
- //std::cout << "PinguActionFactory::delete_actions (): Deleting all Actions:
"
- //<< all_actions.size() << std::endl;
- for (std::vector<PinguAction*>::iterator i = all_actions.begin ();
- i != all_actions.end (); ++i)
- {
- delete *i;
- }
- all_actions.clear ();
- //std::cout << "PinguActionFactory::delete_actions (): Deleting all Actions:
done" << std::endl;
-}
-
-void
-PinguActionFactory::register_factory (ActionName id,
PinguActionAbstractFactory* factory)
-{
- // FIXME: Could need some more error checking
- factories[id] = factory;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingu_action_factory.hpp (from rev 2685,
branches/pingus_sdl/src/pingu_action_factory.hxx)
Deleted: branches/pingus_sdl/src/pingu_action_factory.hxx
===================================================================
--- branches/pingus_sdl/src/pingu_action_factory.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/pingu_action_factory.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,68 +0,0 @@
-// $Id: pingu_action_factory.hxx,v 1.13 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PINGU_ACTION_FACTORY_HXX
-#define HEADER_PINGUS_PINGU_ACTION_FACTORY_HXX
-
-#include <map>
-#include <vector>
-#include "pingu.hxx"
-
-
-class PinguAction;
-class PinguActionAbstractFactory;
-
-class PinguActionFactory
-{
-private:
- /** This vector saves all allocated actions to delete them at a later point
*/
- std::vector<PinguAction*> all_actions;
-
- std::map<Actions::ActionName, PinguActionAbstractFactory*> factories;
- static PinguActionFactory* instance_;
-
- PinguActionFactory ();
- ~PinguActionFactory ();
- void register_core_actions ();
-
-public:
- static PinguActionFactory* instance ();
- static void init();
- static void deinit();
-
- /** \a f will get deleted in destructor! */
- void register_factory (Actions::ActionName id, PinguActionAbstractFactory*
f);
-
- /** Delete all actions which this class has allocated. This needs to
- be called seperatly from the constructor, due to the used
- singleton pattern. [FIXME: if not called memory leak will result] */
- void delete_actions ();
-
- /** Allocate the given action */
- PinguAction* create (Pingu* p, Actions::ActionName id);
-
-private:
- PinguActionFactory (const PinguActionFactory&);
- PinguActionFactory& operator= (const PinguActionFactory&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingu_enums.cpp (from rev 2685,
branches/pingus_sdl/src/pingu_enums.cxx)
Deleted: branches/pingus_sdl/src/pingu_enums.cxx
===================================================================
--- branches/pingus_sdl/src/pingu_enums.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingu_enums.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,123 +0,0 @@
-// $Id: pingu_enums.cxx,v 1.9 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "gettext.h"
-#include "pingu_enums.hxx"
-
-// Pingu "globals". Make [deadly_velocity = 20 * sqrt("normal gravity")] so
-// that the "deadly distance" is the same and therefore doesn't break levels.
-const float deadly_velocity = 10.0f;
-const int pingu_height = 26;
-
-namespace Actions {
-
-std::string action_to_screenname (ActionName action)
-{
- switch (action)
- {
- case Angel : return _("Angel");
- case Basher : return _("Basher");
- case Blocker : return _("Blocker");
- case Boarder : return _("Boarder");
- case Bomber : return _("Bomber");
- case Bridger : return _("Bridger");
- case Climber : return _("Climber");
- case Digger : return _("Digger");
- case Drown : return _("Drown");
- case Exiter : return _("Exiter");
- case Faller : return _("Faller");
- case Floater : return _("Floater");
- case Jumper : return _("Jumper");
- case Laserkill : return _("Laserkill");
- case Miner : return _("Miner");
- case Rocketlauncher : return _("Rocketlauncher");
- case Slider : return _("Slider");
- case Smashed : return _("Smashed");
- case Splashed : return _("Splashed");
- case Superman : return _("Superman");
- case Teleported : return _("Teleported");
- case Waiter : return _("Waiter");
- case Walker : return _("Walker");
- default : return "Unknown ActionName";
- }
-}
-
-std::string action_to_string(ActionName action)
-{
- switch (action)
- {
- case Angel : return "angel";
- case Basher : return "basher";
- case Blocker : return "blocker";
- case Boarder : return "boarder";
- case Bomber : return "bomber";
- case Bridger : return "bridger";
- case Climber : return "climber";
- case Digger : return "digger";
- case Drown : return "drown";
- case Exiter : return "exiter";
- case Faller : return "faller";
- case Floater : return "floater";
- case Jumper : return "jumper";
- case Laserkill : return "laserkill";
- case Miner : return "miner";
- case Rocketlauncher : return "rocketlauncher";
- case Slider : return "slider";
- case Smashed : return "smashed";
- case Splashed : return "splashed";
- case Superman : return "superman";
- case Teleported : return "teleported";
- case Waiter : return "waiter";
- case Walker : return "walker";
- default : return "Unknown ActionName";
- }
-}
-
-ActionName action_from_string(const std::string& action)
-{
- if (action == "angel") return Angel;
- if (action == "basher") return Basher;
- if (action == "blocker") return Blocker;
- if (action == "boarder") return Boarder;
- if (action == "bomber") return Bomber;
- if (action == "bridger") return Bridger;
- if (action == "climber") return Climber;
- if (action == "digger") return Digger;
- if (action == "drown") return Drown;
- if (action == "exiter") return Exiter;
- if (action == "faller") return Faller;
- if (action == "floater") return Floater;
- if (action == "jumper") return Jumper;
- if (action == "laserkill") return Laserkill;
- if (action == "miner") return Miner;
- if (action == "rocketlauncher") return Rocketlauncher;
- if (action == "slider") return Slider;
- if (action == "smashed") return Smashed;
- if (action == "splashed") return Splashed;
- if (action == "superman") return Superman;
- if (action == "teleported") return Teleported;
- if (action == "waiter") return Waiter;
- if (action == "walker") return Walker;
-
- return Walker;
-}
-
-} // namespace Actions
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingu_enums.hpp (from rev 2685,
branches/pingus_sdl/src/pingu_enums.hxx)
Deleted: branches/pingus_sdl/src/pingu_enums.hxx
===================================================================
--- branches/pingus_sdl/src/pingu_enums.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingu_enums.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,87 +0,0 @@
-// $Id: pingu_enums.hxx,v 1.13 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PINGU_ENUMS_HXX
-#define HEADER_PINGUS_PINGU_ENUMS_HXX
-
-#include "pingus.hxx"
-#include <string>
-
-/** The Pingus Status shows the current status of a Pingu, as
- displayed in the PingusCounter pannel. PS_DEAD are pingus that got
- killed, PS_ALIVE are pingus that are still active in the world and
- PS_EXITED are pingus that successfully finished a level
-
- FIXME: different subvalues of PS_DEAD might be usefull (drowned,
- FIXME: splashed, smashed, etc.) */
-enum PinguStatus { PS_ALIVE, PS_EXITED, PS_DEAD };
-
-namespace Actions {
-
-/** The order of the actions here are the same as the order of actions
- in the buttonpanel, so if the order in the buttonpanel is not what
- it should be it needs to be changed here. */
-enum ActionName
- { Angel,
- Basher,
- Blocker,
- Boarder,
- Bomber,
- Bridger,
- Climber,
- Digger,
- Drown,
- Exiter,
- Faller,
- Floater,
- Jumper,
- Laserkill,
- Miner,
- Rocketlauncher,
- Slider,
- Smashed,
- Splashed,
- Superman,
- Teleported,
- Waiter,
- Walker
- };
-
-/** Converts a action enum into its internal string representation, as
- used in the xml or the resource files Bomber => "bomber" */
-std::string action_to_string(ActionName action);
-
-/** Converts a internal action string back into its action enum
- representation "bomber" => Bomber */
-ActionName action_from_string(const std::string& action);
-
-/** Convert a action enum into its visual representation, aka the
- thing that is seen on the screen for the user Bomber => "Bomber" */
-std::string action_to_screenname(ActionName action);
-
-} // namespace Actions
-
-// Pingu "globals"
-extern const int pingu_height;
-extern const float deadly_velocity;
-
-#endif
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingu_holder.cpp (from rev 2685,
branches/pingus_sdl/src/pingu_holder.cxx)
Deleted: branches/pingus_sdl/src/pingu_holder.cxx
===================================================================
--- branches/pingus_sdl/src/pingu_holder.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingu_holder.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,186 +0,0 @@
-// $Id: pingu_holder.cxx,v 1.22 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <assert.h>
-#include "pingu_holder.hxx"
-#include "pingus_level.hxx"
-#include "pingu.hxx"
-
-
-PinguHolder::PinguHolder(const PingusLevel& plf)
- : number_of_allowed(plf.get_number_of_pingus()),
- number_of_exited(0)
-{
-}
-
-PinguHolder::~PinguHolder()
-{
- // Deleting all Pingu objects
- for(std::vector<Pingu*>::iterator i = all_pingus.begin();
- i != all_pingus.end(); ++i)
- delete *i;
-}
-
-Pingu*
-PinguHolder::create_pingu (const Vector3f& pos, int owner_id)
-{
- if (number_of_allowed > get_number_of_released())
- {
- // We use all_pingus.size() as pingu_id, so that id == array
- // index
- Pingu* pingu = new Pingu (all_pingus.size(), pos, owner_id);
-
- // This list will deleted
- all_pingus.push_back (pingu);
-
- // This list holds the active pingus
- pingus.push_back(pingu);
-
- return pingu;
- }
- else
- {
- return 0;
- }
-}
-
-void
-PinguHolder::draw (SceneContext& gc)
-{
- // Draw all walkers
- for(std::list<Pingu*>::iterator pingu = pingus.begin();
- pingu != pingus.end();
- ++pingu)
- {
- if ((*pingu)->get_action() == Actions::Walker)
- (*pingu)->draw (gc);
- }
-
- // Draw all non-walkers, so that they are easier spotable
-
- // FIXME: This might be usefull, but looks kind of ugly in the game
- // FIXME: Bridgers where walkers walk behind are an example of
- // FIMME: uglyness. Either we rip this code out again or fix the
- // FIXME: bridger so that it looks higher and better with walkers
- // FIXME: behind him.
- for(std::list<Pingu*>::iterator pingu = pingus.begin();
- pingu != pingus.end();
- ++pingu)
- {
- if ((*pingu)->get_action() != Actions::Walker)
- (*pingu)->draw (gc);
- }
-}
-
-void
-PinguHolder::update()
-{
- PinguIter pingu = pingus.begin();
-
- while(pingu != pingus.end())
- {
- (*pingu)->update();
-
- // FIXME: The draw-loop is not the place for things like this,
- // this belongs in the update loop
- if ((*pingu)->get_status() == PS_DEAD)
- {
- // Removing the dead pingu and setting the iterator back to
- // the correct possition, no memory hole since pingus will
- // keep track of the allocated Pingus
- pingu = pingus.erase(pingu);
- }
- else if ((*pingu)->get_status() == PS_EXITED)
- {
- number_of_exited += 1;
- pingu = pingus.erase(pingu);
- }
- else
- {
- // move to the next Pingu
- ++pingu;
- }
- }
-}
-
-Pingu*
-PinguHolder::get_pingu(unsigned int id)
-{
- if (id < all_pingus.size())
- {
- Pingu* pingu = all_pingus[id];
-
- assert(pingu->get_id() == id);
-
- if (pingu->get_status() == PS_ALIVE)
- return pingu;
- else
- return 0;
- }
- else
- {
- return 0;
- }
-}
-
-float
-PinguHolder::get_z_pos() const
-{
- return 50;
-}
-
-int
-PinguHolder::get_number_of_exited()
-{
- return number_of_exited;
-}
-
-int
-PinguHolder::get_number_of_killed()
-{
- return all_pingus.size() - pingus.size() - get_number_of_exited();
-}
-
-int
-PinguHolder::get_number_of_alive()
-{
- return pingus.size();
-}
-
-int
-PinguHolder::get_number_of_released()
-{
- return all_pingus.size();
-}
-
-int
-PinguHolder::get_number_of_allowed()
-{
- return number_of_allowed;
-}
-
-unsigned int
-PinguHolder::get_end_id()
-{
- return all_pingus.size();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingu_holder.hpp (from rev 2685,
branches/pingus_sdl/src/pingu_holder.hxx)
Deleted: branches/pingus_sdl/src/pingu_holder.hxx
===================================================================
--- branches/pingus_sdl/src/pingu_holder.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingu_holder.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,122 +0,0 @@
-// $Id: pingu_holder.hxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PINGU_HOLDER_HXX
-#define HEADER_PINGUS_PINGU_HOLDER_HXX
-
-#include <list>
-#include <vector>
-#include "worldobj.hxx"
-
-
-class PingusLevel;
-class Vector3f;
-class Pingu;
-
-typedef std::list<Pingu*>::iterator PinguIter;
-
-/** This class holds all the penguins in the world */
-class PinguHolder : public WorldObj
-{
-private:
- /** The total number of pingus that will get released in this
- level */
- int number_of_allowed;
-
- /** Number of pingus that made it to the exit, we cache this, since
- else we would have to iterate over the whole list and count them
- each time they are requested. */
- int number_of_exited;
-
- /** This vector holds all pingus which are ever allocated in the
- world, its used to free them all on the end of this class. */
- std::vector<Pingu*> all_pingus;
-
- /** A list holding all Pingus, the PinguHolder itself has only the
- active (not dead) ones */
- std::list<Pingu*> pingus;
-
-public:
- PinguHolder(const PingusLevel&);
- ~PinguHolder();
-
- /address@hidden
- @name overloaded stuff for WorldObj
- */
- void draw (SceneContext& gc);
-
- /** Update all Pingus (this calls Pingu::update() which then calls
- PinguAction::update()) */
- void update();
-
- /** The z-pos at which the pingus gets draw.
- @return 50 */
- float get_z_pos() const;
- /address@hidden/
-
- /** @return the number of pingus that have successfully exit this
- level */
- int get_number_of_exited();
-
- /** @return the number of pingus that got killed */
- int get_number_of_killed();
-
- /** @return the number of pingus that are still alive, this is shown
- in the PingusCounter panel as 'Out'. Exited pingus are *not*
- counted. FIXME: name should be different (out, active?!) */
- int get_number_of_alive();
-
- /** @return the total number of pingus released, this is alive +
- killed + exited */
- int get_number_of_released();
-
- /** @return the maximal number of pingus that will get released in
- this level */
- int get_number_of_allowed();
-
- /** @return a reference to a newly create Pingu, the PinguHolder
- will take care of the deletion. The caller *must* not delete the
- Pingu. Might return 0 if all available pingus are already
- released */
- Pingu* create_pingu(const Vector3f& pos, int owner_id);
-
- /** Get a pingu by id, references to dead or exited Pingus are not
- returned, but 0 instead
-
- @return the pingu with the id, or 0 if none found or pingu is
- dead or exited */
- Pingu* get_pingu(unsigned int id);
-
- /** @return the id of the last pingu + 1 */
- unsigned int get_end_id();
-
- // FIXME: Dirty cruft, needs cleanup
- std::list<Pingu*>::iterator begin () { return pingus.begin (); }
- std::list<Pingu*>::iterator end () { return pingus.end (); }
- std::list<Pingu*>::size_type size () { return pingus.size (); }
-
-private:
- PinguHolder (const PinguHolder&);
- PinguHolder& operator= (const PinguHolder&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus.hpp (from rev 2685,
branches/pingus_sdl/src/pingus.hxx)
Deleted: branches/pingus_sdl/src/pingus.hxx
===================================================================
--- branches/pingus_sdl/src/pingus.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/pingus.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,55 +0,0 @@
-// $Id: pingus.hxx,v 1.8 2004/03/29 16:00:54 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <config.h>
-#ifndef HEADER_PINGUS_PINGUS_HXX
-#define HEADER_PINGUS_PINGUS_HXX
-
-/**
- * Multiple hacks, workarounds and helper things which are included
- * everywhere and are used to fix broken compilers or supress
- * warrnings.
- *
- * @file pingus.hxx
- **/
-
-#if defined(WIN32) && !defined(__GNUC__)
-# define for if(0);else for
-
-# define snprintf _snprintf
-
-# pragma warning(disable:4786) //over 255 characters in debug indentifier,
due to STL instantiation
- //sadly this does not actually work on 6.0, but it does in .NET
-
-# pragma warning(disable:4355) //this used in constructor base
-
-# pragma warning(disable:4800) //'int' : forcing value to bool 'true' or
'false' (performance warning)
-
-# include <assert.h>
-#endif
-
-#if defined(WIN32) && defined(__GNUC__) && !defined(HAVE_SSTREAM)
-# define HAVE_SSTREAM
-#endif
-
-#define UNUSED_ARG(a) do {/* null */} while (&a == 0)
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_error.cpp (from rev 2685,
branches/pingus_sdl/src/pingus_error.cxx)
Deleted: branches/pingus_sdl/src/pingus_error.cxx
===================================================================
--- branches/pingus_sdl/src/pingus_error.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingus_error.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,52 +0,0 @@
-// $Id: pingus_error.cxx,v 1.12 2003/12/13 11:21:23 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "pingus_error.hxx"
-#include "gettext.h"
-
-
-PingusError::PingusError (const std::string& mes)
- : message("PingusError: " + mes)
-{
-}
-
-PingusError::~PingusError() throw()
-{
-}
-
-void
-PingusError::raise (const std::string& msg)
-{
- throw PingusError(msg);
-}
-
-const std::string&
-PingusError::get_message () const
-{
- return message;
-}
-
-const char*
-PingusError::what() const throw()
-{
- return message.c_str();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_error.hpp (from rev 2685,
branches/pingus_sdl/src/pingus_error.hxx)
Deleted: branches/pingus_sdl/src/pingus_error.hxx
===================================================================
--- branches/pingus_sdl/src/pingus_error.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingus_error.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,47 +0,0 @@
-// $Id: pingus_error.hxx,v 1.10 2003/12/13 11:21:23 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PINGUS_ERROR_HXX
-#define HEADER_PINGUS_PINGUS_ERROR_HXX
-
-#include "pingus.hxx"
-#include <string>
-#include <exception>
-
-
-/** A PingusError is thrown in situation where an error occured due to
- invalid user input, file not found events or similar stuff. */
-class PingusError : public std::exception
-{
-protected:
- std::string message;
-public:
- PingusError(const std::string& mes);
- ~PingusError() throw();
-
- const std::string& get_message () const;
- const char* what() const throw();
-
- static void raise (const std::string& msg);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_level.cpp (from rev 2685,
branches/pingus_sdl/src/pingus_level.cxx)
Deleted: branches/pingus_sdl/src/pingus_level.cxx
===================================================================
--- branches/pingus_sdl/src/pingus_level.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingus_level.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,181 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "file_reader.hxx"
-#include "pingus_level.hxx"
-#include "pingus_error.hxx"
-#include "pingus_level_impl.hxx"
-
-PingusLevel::PingusLevel()
- : impl(new PingusLevelImpl())
-{
-}
-
-
-PingusLevel::PingusLevel(const std::string& resname,
- const std::string& filename)
- : impl(new PingusLevelImpl())
-{
- impl->resname = resname;
- FileReader reader = FileReader::parse(filename);
-
- if (reader.get_name() != "pingus-level")
- {
- PingusError::raise("Error: " + filename + ": not a 'pingus-level' file");
- }
- else
- {
- int version;
- if (reader.read_int("version", version))
- std::cout << "Levelfile Version: " << version << std::endl;
- else
- std::cout << "Unknown Levelfile Version: " << version << std::endl;
-
- FileReader head;
- if (!reader.read_section("head", head))
- {
- PingusError::raise("Error: (head) section not found in '" + filename
+ "'");
- }
- else
- {
- std::cout << "Reading head" << std::endl;
- head.read_string("levelname", impl->levelname);
- head.read_string("description", impl->description);
- head.read_size ("levelsize", impl->size);
- head.read_string("music", impl->music);
- head.read_int ("time", impl->time);
- head.read_int ("difficulty", impl->difficulty);
- head.read_int ("number-of-pingus", impl->number_of_pingus);
- head.read_int ("number-to-save", impl->number_to_save);
- head.read_color ("ambient-light", impl->ambient_light);
- head.read_string("author", impl->author);
-
- std::cout << "Size: " << impl->size.width << " " <<
impl->size.height << std::endl;
-
- FileReader actions;
- if (head.read_section("actions", actions))
- {
- std::vector<std::string> lst = actions.get_section_names();
- for(std::vector<std::string>::iterator i = lst.begin(); i !=
lst.end(); ++i)
- {
- int count = 0;
- std::cout << "Actions: " << i->c_str() << std::endl;
- if (actions.read_int(i->c_str(), count))
- impl->actions[*i] = count;
- }
- }
- else
- {
- PingusError::raise("Error: (pingus-level head actions) not found
in '" + filename + "'");
- }
- }
-
- FileReader objects;
- if (reader.read_section("objects", objects))
- {
- std::vector<FileReader> object_lst = objects.get_sections();
- for(std::vector<FileReader>::iterator i = object_lst.begin(); i !=
object_lst.end(); ++i)
- {
- impl->objects.push_back(*i);
- }
- }
- }
-}
-
-const std::string&
-PingusLevel::get_levelname() const
-{
- return impl->levelname;
-}
-
-const std::string&
-PingusLevel::get_description() const
-{
- return impl->description;
-}
-
-const Size&
-PingusLevel::get_size() const
-{
- return impl->size;
-}
-
-int
-PingusLevel::get_number_of_pingus() const
-{
- return impl->number_of_pingus;
-}
-
-int
-PingusLevel::get_number_to_save() const
-{
- return impl->number_to_save;
-}
-
-const std::map<std::string, int>&
-PingusLevel::get_actions() const
-{
- return impl->actions;
-}
-
-int
-PingusLevel::get_time() const
-{
- return impl->time;
-}
-
-int
-PingusLevel::get_difficulty() const
-{
- return impl->difficulty;
-}
-
-const std::string&
-PingusLevel::get_author() const
-{
- return impl->author;
-}
-
-const std::string&
-PingusLevel::get_music() const
-{
- return impl->music;
-}
-
-const std::vector<FileReader>&
-PingusLevel::get_objects() const
-{
- return impl->objects;
-}
-
-const std::string
-PingusLevel::get_resname() const
-{
- return impl->resname;
-}
-
-const Color&
-PingusLevel::get_ambient_light() const
-{
- return impl->ambient_light;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_level.hpp (from rev 2685,
branches/pingus_sdl/src/pingus_level.hxx)
Deleted: branches/pingus_sdl/src/pingus_level.hxx
===================================================================
--- branches/pingus_sdl/src/pingus_level.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingus_level.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,92 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_LEVEL_HXX
-#define HEADER_PINGUS_LEVEL_HXX
-
-#include <string>
-#include <vector>
-#include <map>
-#include "shared_ptr.hxx"
-#include "file_reader.hxx"
-
-
-class FileReader;
-class PingusLevelImpl;
-
-/** This class represents a Pingus Level, its metadata and its body
- (groundpieces, worldobjs, etc.) alike. */
-class PingusLevel
-{
-public:
- PingusLevel();
-
- PingusLevel(const std::string& resname,
- const std::string& filename);
-
- /** Returns the name of the current level, {\em not} the level file name. */
- const std::string& get_levelname() const;
-
- /** Returns the description of the level, which fit to the current
- language */
- const std::string& get_description() const;
-
- /** Returns the width of the level */
- const Size& get_size() const;
-
- /** Returns the number of Pingus, which are going to be released in
- this level. */
- int get_number_of_pingus() const;
-
- /** Returns the number of pingus you need to save in this level. */
- int get_number_to_save() const;
-
- /** Number of Actions that are available to the user (ActionName, number of
them) */
- const std::map<std::string, int>& get_actions() const;
-
- /** Returns the time you have to complete a level */
- int get_time() const;
-
- /** Returns the difficulty of the current level */
- int get_difficulty() const;
-
- /** Returns the name of the author, who creates this level */
- const std::string& get_author() const;
-
- /** Returns the ResDescriptor where the music for this level can be
- found. The ResDescriptor points normaly to a file. */
- const std::string& get_music() const;
-
- /** Returns the light to be used in this level */
- const Color& get_ambient_light() const;
-
- /** Returns the body of this file */
- const std::vector<FileReader>& get_objects() const;
-
- /** Return the 'resource name' of the level ('snow22-grumbel', etc. ) */
- const std::string get_resname() const;
-
-protected:
- SharedPtr<PingusLevelImpl> impl;
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_level_impl.hpp (from rev 2685,
branches/pingus_sdl/src/pingus_level_impl.hxx)
Deleted: branches/pingus_sdl/src/pingus_level_impl.hxx
===================================================================
--- branches/pingus_sdl/src/pingus_level_impl.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/pingus_level_impl.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,66 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_LEVEL_IMPL_HXX
-#define HEADER_PINGUS_LEVEL_IMPL_HXX
-
-#include "math/size.hpp"
-#include "math/color.hpp"
-#include <string>
-#include <vector>
-#include <map>
-
-class PingusLevelImpl
-{
-public:
-
- // Set defaults in constructor
- PingusLevelImpl()
- : ambient_light(255, 255, 255, 255),
- music("none")
- {
- // Do nothing
- }
-
- std::string resname;
-
- std::string levelname;
- std::string description;
-
- Color ambient_light;
- Size size;
-
- int number_of_pingus;
- int number_to_save;
-
- std::map<std::string, int> actions;
-
- int time;
- int difficulty;
-
- std::string author;
- std::string music;
-
- std::vector<FileReader> objects;
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_level_test.cpp (from rev 2685,
branches/pingus_sdl/src/pingus_level_test.cxx)
Deleted: branches/pingus_sdl/src/pingus_level_test.cxx
===================================================================
--- branches/pingus_sdl/src/pingus_level_test.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/pingus_level_test.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,69 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <ClanLib/core.h>
-#include "xml_pingus_level.hxx"
-#include "pingus_level.hxx"
-#include "pingus_error.hxx"
-
-using namespace Pingus;
-
-int main(int argc, char** argv)
-{
- try
- {
- CL_SetupCore setup_core;
- PingusLevel level = XMLPingusLevel("levelout.xml", "levelout.xml");
-
- std::cout << "Levelname: " << level.get_levelname() << std::endl;
- std::cout << "Description: " << level.get_description() <<
std::endl;
- std::cout << "Size: " << level.get_size() << std::endl;
- std::cout << "Number of Pingus: " << level.get_number_of_pingus() <<
std::endl;
- std::cout << "Number to Save: " << level.get_number_to_save() <<
std::endl;
- std::cout << "Time: " << level.get_time() << std::endl;
- std::cout << "Difficulty: " << level.get_difficulty() << std::endl;
- std::cout << "Author: " << level.get_author() << std::endl;
- std::cout << "Music: " << level.get_music() << std::endl;
- std::cout << "Actions: " << std::endl;
- const std::map<std::string, int>& actions = level.get_actions();
- for(std::map<std::string, int>::const_iterator i = actions.begin(); i !=
actions.end(); ++i)
- {
- std::cout << " " << i->first << ": " << i->second << std::endl;
- }
-
- std::cout << "Objects: " << std::endl;
- const std::vector<FileReader>& objects = level.get_objects();
- for(std::vector<FileReader>::const_iterator i = objects.begin();
- i != objects.end(); ++i)
- {
- std::cout << " " << i->get_name() << std::endl;
- }
- }
- catch (CL_Error& err)
- {
- std::cout << "CL_Error: " << err.message << std::endl;
- }
- catch (PingusError& err)
- {
- std::cout << "PingusError: " << err.what() << std::endl;
- }
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_main.cpp (from rev 2685,
branches/pingus_sdl/src/pingus_main.cxx)
Deleted: branches/pingus_sdl/src/pingus_main.cxx
===================================================================
--- branches/pingus_sdl/src/pingus_main.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingus_main.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,991 +0,0 @@
-// $Id: pingus_main.cxx,v 1.104 2004/04/01 15:18:05 torangan Exp $
-// ___
-// | _ \ | ,--. |
-// | /_ _ _ ___ _ _ ___ | ,-/ o \ |
-// | || || \ || _ || |_| ||_ -' | `-. / |
-// |__||_||_\_||_ ||_____||___| | /\ \ |
-// _| | | | |_| | |
-// |___| | o\/____\ |
-//
-// Copyright (C) 1998 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-#include <config.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <signal.h>
-#include <locale.h>
-#include <iostream>
-#include <physfs.h>
-#include "lisp/lisp.hpp"
-#include "lisp/parser.hpp"
-#include "sexpr_file_reader.hpp"
-
-#include "SDL.h"
-
-//#include <ClanLib/display.h>
-//#include <ClanLib/sound.h>
-//#include <ClanLib/core.h>
-//#include <ClanLib/sdl.h>
-//#include <ClanLib/gl.h>
-//#include <ClanLib/gui.h>
-
-#include "gettext.h"
-
-#include "command_line.hpp"
-
-#include "gui/screen_manager.hxx"
-#include "dummy_screen.hxx"
-// #include "gui/input_debug_screen.hxx"
-#include "path_manager.hxx"
-#include "pingus_main.hxx"
-#include "globals.hxx"
-#include "system.hxx"
-#include "pingus_error.hxx"
-// #include "global_event.hxx"
-#include "config.hxx"
-#include "console.hxx"
-// #include "fps_counter.hxx"
-#include "plf_res_mgr.hxx"
-#include "game_session.hxx"
-#include "story_screen.hxx"
-
-#include "start_screen.hxx"
-#include "savegame_manager.hxx"
-#include "stat_manager.hxx"
-// #include "demo_session.hxx"
-#include "debug.hxx"
-//#include "fonts.hxx"
-#include "pingus_menu_manager.hxx"
-#include "resource.hxx"
-#include "pingu_action_factory.hxx"
-#include "credits.hxx"
-#include "sound/sound.hxx"
-#include "worldmap/manager.hxx"
-#include "cheat.hxx"
-// #include "blitter_test.hxx"
-// #include "preview_renderer.hxx"
-#include "worldmap/manager.hxx"
-#include "worldobj_factory.hxx"
-
-#include "editor/editor_screen.hxx"
-
-#if _MSC_VER >= 1400
-// Disable stupid deprecation warnings
-#pragma warning( disable : 4996 )
-#endif
-
-
-void
-signal_handler(int signo)
-{
- switch(signo)
- {
- case SIGSEGV:
-
puts("\n,------------------------------------------------------------------------");
- puts(_("| segfault_handler: catched a SIGSEGV."));
- puts ("|");
- puts(_("| Woops, Pingus just crashed, congratulations you've found a
bug."));
- puts(_("| Please write a little bug report to <address@hidden>, include
informations"));
- puts(_("| where exacly the SIGSEGV occured and how to reproduce it."));
- puts(_("| Also try include a backtrace, you can get it like this:"));
- puts ("|");
- puts ("| $ gdb pingus core");
- puts ("| (gdb) bt");
- puts ("| ...");
- puts ("|");
- puts(_("| If that doesn't work, try this:"));
- puts ("|");
- puts ("| $ gdb pingus");
- puts ("| (gdb) r");
- puts(_("| [play until it crashes again]"));
- puts ("| ...");
- puts ("|");
- puts
("'------------------------------------------------------------------------\n");
- break;
-
- case SIGINT:
-
puts("\n,------------------------------------------------------------------------");
- puts (_("| Warning: Pingus recieved a SIGINT, exiting now."));
-
puts("`------------------------------------------------------------------------\n");
- break;
-
- default:
- std::cout << "signal_handler (): Got unknown signal: " << signo <<
std::endl;
- break;
- }
- puts ("exit(EXIT_FAILURE);");
- abort();
- throw "crash";
-}
-
-PingusMain::PingusMain() :
- blitter_test(false),
- show_credits(false),
- editor(false),
- refresh_rate(60)
-{
-}
-
-PingusMain::~PingusMain()
-{
-}
-
-char*
-PingusMain::get_title()
-{
-#ifdef OFFICIAL_PINGUS_BUILD
- static char title[] = "Pingus "VERSION" - http://pingus.seul.org";
-#else
- static char title[] = "Pingus "VERSION" (unofficial build) -
http://pingus.seul.org";
-#endif
- return title;
- //return (string(PACKAGE) + " " + VERSION + " -
http://pingus.seul.org").c_str();
-}
-
-void
-PingusMain::read_rc_file (void)
-{
- if (!no_config_file)
- {
- std::string rcfile;
-
- if (config_file.empty())
- rcfile = System::get_statdir() + "config";
- else
- rcfile = config_file;
-
- //constructor of config must be run
- Config config(rcfile);
- }
-}
-
-// Checking for all options, which needs to be known *before* the
-// config file is read.
-void
-PingusMain::quick_check_args(int argc, char** argv)
-{
- no_config_file = false;
- for(int i=1; i < argc; ++i)
- {
- if (strcmp(argv[i], "--no-cfg-file") == 0)
- {
- no_config_file = true;
- }
- }
-}
-
-// check_ars() checks the command line for options and set the
-// corresponding global variables to the set values.
-void
-PingusMain::check_args(int argc, char** argv)
-{
-#ifdef WIN32
- cursor_enabled = true;
-#endif
-
- CommandLine argp;
- argp.add_usage("pingus [OPTIONS]... [FILES]...");
- argp.add_doc("Pingus is a puzzle game where you need to guide a bunch of
little penguins around the world.");
-
- argp.add_group(_("Options:"));
- argp.add_option('g', "geometry", "{width}x{height}",
- _("Set the resolution for pingus (default: 800x600)"));
- argp.add_option('h', "help", "",
- _("Displays this help"));
- argp.add_option('n', "disable-intro", "",
- _("Disable intro"));
- argp.add_option('G', "use-opengl", "",
- _("Use OpenGL"));
- argp.add_option('S', "use-sdl", "",
- _("Use SDL"));
- argp.add_option('w', "window", "",
- _("Start in Window Mode"));
- argp.add_option('f', "fullscreen", "",
- _("Start in Fullscreen"));
- argp.add_option('R', "refresh-rate", "",
- _("Set the refresh rate in fullscreen (default: 60)"));
- argp.add_option('d', "datadir", _("PATH"),
- _("Set the path to load the data files to 'path'"));
- argp.add_option('l', "level", _("FILE"),
- _("Load a custom level from FILE"));
- argp.add_option(358, "worldmap", _("FILE"),
- _("Load a custom worldmap from FILE"));
- argp.add_option('e', "editor", "",
- _("Loads the level editor"));
- argp.add_option('v', "verbose", "",
- _("Print some more messages to stdout, can be set multiple
times to increase verbosity"));
- argp.add_option('V', "version", "",
- _("Prints version number and exit"));
- argp.add_option(337, "disable-auto-scrolling", "",
- _("Disable automatic scrolling"));
- argp.add_option(346, "enable-swcursor", "",
- _("Enable software cursor"));
- argp.add_option(342, "no-cfg-file", "",
- _("Don't read ~/.pingus/config"));
- argp.add_option(347, "config-file", "", _("FILE"),
- _("Read config from FILE (default: ~/.pingus/config) reduce
CPU usage, "
- "might speed up the game on slower machines"));
- argp.add_option(360, "controller", "FILE",
- _("Uses the controller given in FILE"));
-
- argp.add_group(_("Debugging and experimental stuff:"));
- argp.add_option(334, "maintainer-mode", "",
- _("Enables some features, only interesting programmers"));
- argp.add_option(352, "debug", "OPTION",
- _("Enable the output of debugging infos, possible"
- "OPTION's are tiles, gametime, actions, sound, resources,
gui,"
- "input, pathmgr"));
- argp.add_option(354, "min-frame-skip", "N",
- _("Skip at least N frames, larger values speed the game
up"));
- argp.add_option(355, "max-frame-skip", "N",
- _("Skip at most N frames"));
- argp.add_option(357, "frame-skip", "N",
- _("Set both min and max frameskip to N"));
- argp.add_option('t', "speed", "SPEED",
- _("Set the game speed (0=fastest, >0=slower)"));
- argp.add_option('b', "print-fps", "",
- _("Prints the fps to stdout"));
- argp.add_option(344, "tile-size", "INT",
- _("Set the size of the map tiles (default: 32)"));
- argp.add_option(332, "fast-mode", "",
- _("Disable some cpu intensive features"));
- argp.add_option(353, "min-cpu-usage", "",
- _("Reduces the CPU usage by issuing sleep()"));
- argp.add_option(359, "credits", "",
- _("Shows the credits"));
-
- argp.add_group(_("Demo playing and recording:"));
- argp.add_option('p', "play-demo", _("FILE"),
- _("Plays a demo session from FILE"));
- argp.add_option('r', "disable-demo-recording", "",
- _("Record demos for each played level"));
-
- argp.add_group(_("Sound:"));
- argp.add_option('s', "disable-sound", "",
- _("Disable sound"));
- argp.add_option('m', "disable-music", "",
- _("Disable music"));
-
- argp.parse_args(argc, argv);
- argp.set_help_indent(20);
-
- while (argp.next())
- {
- switch (argp.get_key())
- {
- case 'c': // -c, --enable-cursor
- cursor_enabled = true;
- if (verbose) std::cout << "PingusMain:check_args: Cursor enabled" <<
std::endl;
- break;
-
- case 'b': // -b, --print-fps
- print_fps = true;
- if (verbose) std::cout << "PingusMain:check_args: Printing fps
enabled" << std::endl;
- break;
-
- case 358: // --worldmap
- worldmapfile = argp.get_argument();
- break;
-
- case 359: // --credits
- show_credits = true;
- break;
-
- case 'l': // -l, --level
- levelfile = argp.get_argument();
- break;
-
- case 'e': // -e, --editor
- editor = true;
-
- case 't': // -t, --set-speed
- game_speed = atoi(argp.get_argument().c_str());
- break;
-
- case 'G':
- use_opengl = true;
- break;
-
- case 'S':
- use_opengl = false;
- break;
-
- case 's': // -s, --disable-sound
- sound_enabled = false;
- break;
-
- case 'g':
- {
- char c;
- if (sscanf(argp.get_argument().c_str(), "%d%c%d", &screen_width,
&c, &screen_height) != 3 && c != 'x')
- {
- std::cout << "Resolution std::string is wrong, it should be
like: \n"
- << "\"640x480\" or \"800x600\"" << std::endl;
- exit(EXIT_FAILURE);
- }
- if (screen_width > 800 || screen_height > 600)
- {
- std::cout << _("Warning: Larger resolution than 800x600 will
result in visual problems") << std::endl;
- }
- }
- break;
-
- case 'm': // -m, --disable-music
- music_enabled = false;
- break;
-
- case 'd': // -d, --datadir
- path_manager.add_path(argp.get_argument());
-
- if (verbose)
- std::cout << "check_args: Pingus Data Dir = "
- << argp.get_argument() << std::endl;
- break;
-
- case 'V':
- std::cout << "Pingus Version " << VERSION
-#ifndef OFFICIAL_PINGUS_BUILD
- << " (unofficial build)"
-#endif
- << std::endl;
-
- std::cout << "\n"
- "Copyright (C) 2003 Ingo Ruhnke <address@hidden>\n"
- "There is NO warranty. You may redistribute this software\n"
- "under the terms of the GNU General Public License.\n"
- "For more information about these matters, see the files named
COPYING." << std::endl;
-
- exit(EXIT_SUCCESS);
- break;
- case 'r': // -r, --enabled-demo-recording
- enable_demo_recording = false;
- break;
- case 'p': // -p, --play-demo
- play_demo = true;
- demo_file = argp.get_argument();
- if (verbose)
- std::cout << "Using demofile: " << demo_file << std::endl;
- break;
- case 'v':
- sscanf(argp.get_argument().c_str(), "%d", &verbose);
- std::cout << "Pingus: Verbose level is " << verbose << std::endl;
- break;
-
- case 'f': // --fullscreen
- fullscreen_enabled = true;
- break;
-
- case 'R': // --refresh-rate
- sscanf(argp.get_argument().c_str(), "%d", &refresh_rate);
- std::cout << "Pingus: Refresh rate is " << refresh_rate << std::endl;
- break;
-
- case 'w': // --window
- fullscreen_enabled = false;
- break;
-
- // Starting weird number options... no idea if this is correct.
- case 332:
- fast_mode = true;
- break;
- case 334: // --maintainer_mode
- std::cout << "---------------------------------" << std::endl
- << "--- Maintainer Mode activated ---" << std::endl
- << "---------------------------------" << std::endl;
- maintainer_mode = true;
- break;
-
- case 337:
- auto_scrolling = false;
- break;
- case 342: // --no-cfg-file
- // Nothing, since that is handled in quick_check_args()
- break;
-
- case 344:
- sscanf(argp.get_argument().c_str(), "%d", &tile_size);
- break;
-
- case 345:
- swcursor_enabled = false;
- break;
-
- case 346:
- swcursor_enabled = true;
- break;
-
- case 347:
- config_file = argp.get_argument();
- break;
-
- case 352:
- if (argp.get_argument() == "all")
- {
- pingus_debug_flags |= PINGUS_DEBUG_ALL;
- }
- else if (argp.get_argument() == "actions")
- {
- pingus_debug_flags |= PINGUS_DEBUG_ACTIONS;
- }
- else if (argp.get_argument() == "sound")
- {
- pingus_debug_flags |= PINGUS_DEBUG_SOUND;
- }
- else if (argp.get_argument() == "gametime")
- {
- pingus_debug_flags |= PINGUS_DEBUG_GAMETIME;
- }
- else if (argp.get_argument() == "tiles")
- {
- pingus_debug_flags |= PINGUS_DEBUG_TILES;
- }
- else if (argp.get_argument() == "loading")
- {
- pingus_debug_flags |= PINGUS_DEBUG_LOADING;
- }
- else if (argp.get_argument() == "translator")
- {
- pingus_debug_flags |= PINGUS_DEBUG_TRANSLATOR;
- }
- else if (argp.get_argument() == "resources")
- {
- pingus_debug_flags |= PINGUS_DEBUG_RESOURCES;
- }
- else if (argp.get_argument() == "gui")
- {
- pingus_debug_flags |= PINGUS_DEBUG_GUI;
- }
- else if (argp.get_argument() == "input")
- {
- pingus_debug_flags |= PINGUS_DEBUG_INPUT;
- }
- else if (argp.get_argument() == "worldmap")
- {
- pingus_debug_flags |= PINGUS_DEBUG_WORLDMAP;
- }
- else if (argp.get_argument() == "pathmgr")
- {
- pingus_debug_flags |= PINGUS_DEBUG_PATHMGR;
- }
- else
- {
- std::cout << "PingusMain: Unhandled debug flag: " <<
argp.get_argument() << std::endl;
- exit(EXIT_FAILURE);
- }
-
- break;
-
- case 353:
- max_cpu_usage = false;
- break;
-
- case 354:
- sscanf(argp.get_argument().c_str(), "%d", &min_frame_skip);
- break;
-
- case 355: // max_frame_skip
- sscanf(argp.get_argument().c_str(), "%d", &max_frame_skip);
- break;
-
- case 357: // frame_skip
- sscanf(argp.get_argument().c_str(), "%d", &max_frame_skip);
- min_frame_skip = max_frame_skip;
- break;
-
- case 356: // Cheats
- Cheat::activate(argp.get_argument());
- break;
-
- case 360:
- controller_file = argp.get_argument();
- break;
-
- case 361:
- std::cout << "Rendering a Level Preview..." << std::endl;
- render_preview = true;
- preview_file = argp.get_argument();
- break;
-
- case 362: // Blitter test
- blitter_test = true;
- break;
-
- case 'h':
- argp.print_help();
- exit(EXIT_SUCCESS);
- break;
-
- case CommandLine::REST_ARG:
- if (levelfile.empty())
- {
- levelfile = argp.get_argument();
-
- if (!System::exist(levelfile))
- {
- std::cout << "PingusMain: " << levelfile << " not found" <<
std::endl;
- exit (EXIT_FAILURE);
- }
- }
- else
- {
- std::cout << "Wrong argument: '" << argp.get_argument() << "'"
<< std::endl;
- std::cout << "A levelfile is already given," << std::endl;
- exit(EXIT_FAILURE);
- }
- break;
-
- default:
- std::cout << "Error: Got " << argp.get_key() << " " <<
argp.get_argument() << std::endl;
- break;
- }
- }
-
- // make sure that we're not recording a demo while already playing one
- if (play_demo)
- enable_demo_recording = false;
-}
-
-// Get all filenames and directories
-void
-PingusMain::init_path_finder()
-{
- System::init_directories();
-
- if (maintainer_mode)
- std::cout << "Directory name of " << executable_name << " - " <<
System::dirname(executable_name)
- << std::endl;
-
-#ifdef __APPLE__
- char resource_path[PATH_MAX];
- CFURLRef ref = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
- if (!ref || !CFURLGetFileSystemRepresentation(ref, true,
(UInt8*)resource_path, PATH_MAX))
- {
- std::cout << "Error: Couldn't get Resources path.\n" << std::endl;
- exit(EXIT_FAILURE);
- }
- CFRelease(ref);
- //path_manager.add_path(CL_String::get_path(std::string(resource_path) +
"/data/"));
-#else
- //path_manager.add_path(CL_String::get_path(CL_System::get_exe_path() +
"/data/"));
- //path_manager.add_path(CL_String::get_path(CL_System::get_exe_path() +
"/../data/"));
- //path_manager.add_path(CL_String::get_path(CL_System::get_exe_path() +
"/../share/games/pingus/"));
-#endif
-
- std::list<std::string> file_list;
- file_list.push_back ("data/core.xml");
-
- // if (!path_manager.find_path (file_list))
- // {
- // std::cout << "Error: Couldn't find 'data/core.xml', please set the
enviroment variable\n"
- // << "PINGUS_DATADIR to the path of the file
`data/core.scr' or use the\n"
- // << "-d option." << std::endl;
- // exit(EXIT_FAILURE);
- // }
-
- dictionary_manager.add_directory(path_manager.complete("po/"));
- // Language is automatically picked from env variable
- // dictionary_manager.set_language("de");
-
- const char* lang = getenv("LC_ALL");
- if(!lang) lang = getenv("LC_MESSAGES");
- if(!lang) lang = getenv("LANG");
- if(lang)
- {
- std::string language(lang);
- language.resize(2);
- if(language == "cs" || language == "sr")
- {
- dictionary_manager.set_charset("ISO-8859-2");
- //Pingus::Fonts::encoding = "ISO-8859-2";
- }
- else if(language == "tr")
- {
- dictionary_manager.set_charset("ISO-8859-9");
- //Pingus::Fonts::encoding = "ISO-8859-9";
- }
- else
- {
- dictionary_manager.set_charset("ISO-8859-1");
- //Pingus::Fonts::encoding = "ISO-8859-1";
- }
- }
-
- if (maintainer_mode)
- std::cout << "BasePath: " << path_manager.get_base_path () << std::endl;
-}
-
-void
-PingusMain::print_greeting_message()
-{
- std::string greeting = "Welcome to Pingus "VERSION;
-#ifndef OFFICIAL_PINGUS_BUILD
- greeting += " (unofficial build)";
-#endif
- greeting += "!";
- std::cout << greeting << std::endl;
- for (unsigned int i = 0; i < greeting.length(); ++i)
- std::cout.put('=');
- std::cout << std::endl;
-
-#ifdef HAVE_LIBCLANVORBIS
- std::cout << _("clanVorbis support: ok") << std::endl;
-#else
- std::cout << _("clanVoribs support: missing (.ogg music files will not be
playable)") << std::endl;
-#endif
-
-#ifdef HAVE_LIBCLANMIKMOD
- std::cout << _("clanMikMod support: ok") << std::endl;
-#else
- std::cout << _("clanMikMod support: missing (music files will not be
playable)") << std::endl;
-#endif
-
-#ifdef HAVE_GETTEXT
- std::cout << _("getext support: ok") << std::endl;
- std::cout << _("gettext language: english") << std::endl;
-#else
- std::cout << "getext support: missing (only support for english will be
available)" << std::endl;
-#endif
-
- if (sound_enabled)
- std::cout << _("sound support: enabled") << std::endl;
- else
- std::cout << _("sound support: disabled") << std::endl;
-
- if (music_enabled)
- std::cout << _("music support: enabled") << std::endl;
- else
- std::cout << _("music support: disabled") << std::endl;
-
- std::cout << _("resolution set to: ") << screen_width << "x" <<
screen_height << std::endl;
- std::cout << _("fullscreen: ")
- << (fullscreen_enabled ? _(" enabled") : _("disabled"))
- << std::endl;
- std::cout << _("refresh rate: ") << refresh_rate << std::endl;
- std::cout << _("using OpenGL: ") << use_opengl << std::endl;
-
- std::cout << std::endl;
-}
-
-void
-PingusMain::start_game ()
-{
- if (verbose) {
- pout << _("PingusMain: Starting Main: ") << SDL_GetTicks() << std::endl;
- }
-
- //if (print_fps)
- // Display::add_flip_screen_hook(&fps_counter);
-
- if (!render_preview)
- {
- // Register the global event catcher
- //on_button_press_slot =
window->get_ic()->get_keyboard().sig_key_down().connect (&global_event,
&GlobalEvent::on_button_press);
- //on_button_release_slot =
window->get_ic()->get_keyboard().sig_key_up().connect (&global_event,
&GlobalEvent::on_button_release);
- }
-
- // Set the root screen
- if (show_input_debug_screen) // show a debug screen
- {
- //ScreenManager::instance()->push_screen(new InputDebugScreen (), true);
- }
- else if (render_preview)
- {
- if (levelfile.empty())
- {
- PingusError::raise("You need to give a level file to render a
preview");
- }
- else
- {
-
//PreviewRenderer::render(PLFResMgr::load_plf_from_filename(levelfile),
- // preview_file);
- }
- }
- else if (show_credits)
- {
- ScreenManager::instance()->push_screen(Credits::instance(), false);
- }
- else if (!levelfile.empty ())
- {
- bool successfull = true;
- if (!System::exist(levelfile))
- {
- if (System::exist(levelfile + ".xml"))
- levelfile += ".pingus";
- else if (System::exist("levels/" + levelfile + ".pingus"))
- levelfile = "levels/" + levelfile + ".pingus";
- else
- {
- pout << _("PingusMain: Levelfile not found, ignoring: ") <<
levelfile << std::endl;
- successfull = false;
- }
- }
-
- if (successfull)
- {
- ////ScreenManager::instance()->push_screen
- ////(new StartScreen(PLFResMgr::load_plf_from_filename(levelfile)),
- ////true);
- ScreenManager::instance()->push_screen
- (new
PingusGameSession(PLFResMgr::load_plf_from_filename(levelfile), false),
- true);
- }
- }
- else if (!demo_file.empty()) // start a demo
- {
- //ScreenManager::instance()->push_screen(new DemoSession (demo_file));
- }
- else if (!worldmapfile.empty())
- {
- WorldMapNS::WorldMapManager::instance()->load(worldmapfile);
-
ScreenManager::instance()->push_screen(WorldMapNS::WorldMapManager::instance());
- }
- else if (editor == true)
- {
- ScreenManager::instance()->push_screen (new Editor::EditorScreen());
- }
- else // start a normal game
- {
- std::cout << "starting normal game" << std::endl;
- ScreenManager::instance()->push_screen(PingusMenuManager::instance (),
false);
- ///ScreenManager::instance()->push_screen(new StoryScreen(), true);
- //ScreenManager::instance()->push_screen(new DummyScreen(), true);
- std::cout << "done: starting normal game" << std::endl;
- }
-
- if (!render_preview)
- {
- // show the main menu, the rest of the game is spawn from there
- if (maintainer_mode)
- std::cout << "PingusMain::start screen manager" << std::endl;
- ScreenManager::instance()->display();
- if (maintainer_mode)
- std::cout << "PingusMain::quit game and screen_manager" << std::endl;
-
- // unregister the global event catcher
-
////window->get_ic()->get_keyboard().sig_key_down().disconnect(on_button_press_slot);
-
////window->get_ic()->get_keyboard().sig_key_up().disconnect(on_button_release_slot);
- }
-}
-
-int
-PingusMain::main(int argc, char** argv)
-{
- PHYSFS_init(argv[0]);
- PHYSFS_addToSearchPath("data", 0);
- PHYSFS_addToSearchPath(".", 0);
-
- executable_name = argv[0];
-
- // Register the segfault_handler
-#ifndef WIN32
- signal(SIGSEGV, signal_handler);
-#endif
- //signal(SIGINT, signal_handler);
-
- // Init error/warning/notice streams
- pout.add (std::cout);
- pout.add (console);
- pwarn.add (std::cout);
- pout.add (console);
- perr.add (std::cout);
- perr.add (console);
-
- try
- {
- init_path_finder();
-
- quick_check_args(argc, argv);
- read_rc_file();
- check_args(argc, argv);
-
- print_greeting_message();
-
- init_sdl();
- init_pingus();
-
- // Avoid uglyness on window opening
- if (!render_preview)
- {
- ////CL_Display::clear();
- ////CL_Display::flip();
- }
-
- if (blitter_test)
- {
- ////BlitterTest test;
- ////test.run();
- }
- else
- {
- start_game();
- }
- }
-
- ////catch (const CL_Error& err) {
- ////std::cout << _("Error caught from ClanLib: ") << err.message <<
std::endl;
-////}
-
- catch (const PingusError& err) {
- std::cout << _("Error caught from Pingus: ") << err.get_message () <<
std::endl;
- }
-
- catch (const std::bad_alloc&) {
- std::cout << _("Pingus: Out of memory!") << std::endl;
- }
-
- catch (const std::exception& a) {
- std::cout << _("Pingus: Standard exception caught!:\n") << a.what() <<
std::endl;
- }
-
- catch (...) {
- std::cout << _("Pingus: Unknown throw caught!") << std::endl;
- }
-
- deinit_pingus();
- deinit_clanlib();
-
- PHYSFS_deinit();
-
- return 0;
-}
-
-void
-PingusMain::init_sdl()
-{
- if (SDL_Init(SDL_INIT_VIDEO) != 0) {
- std::cout << "Unable to initialize SDL: " << SDL_GetError() << std::endl;
- exit(1);
- }
- atexit(SDL_Quit);
- Display::set_video_mode(screen_width, screen_height);
- SDL_WM_SetCaption(PACKAGE_STRING " - SDL Edition", 0 /* icon */);
-}
-
-void
-PingusMain::deinit_sdl()
-{
-}
-
-void
-PingusMain::init_clanlib()
-{
-#if 0
- if (render_preview)
- {
- CL_SetupCore::init ();
- // Register only the resource types
- CL_SetupDisplay::init(true);
- }
- else
- {
- CL_SetupCore::init ();
-
- if (use_opengl) CL_SetupGL::init();
- else CL_SetupSDL::init();
-
- CL_SetupDisplay::init();
-
- if (verbose) {
- std::cout << "Using resolution: "
- << screen_width << "x" << screen_height << std::endl;
- }
-
- CL_DisplayWindowDescription window_desc;
- window_desc.set_size(CL_Size(screen_width, screen_height));
- window_desc.set_title(PACKAGE_STRING);
- window_desc.set_fullscreen(fullscreen_enabled);
- window_desc.set_allow_resize(false);
- window_desc.set_refresh_rate(refresh_rate);
-
- window = new CL_DisplayWindow(window_desc);
-
- //CL_Display::clear();
- // CL_Display::flip();
- }
- CL_SetupGUI::init ();
-
- on_exit_press_slot = window->sig_window_close().connect(this,
&PingusMain::on_exit_press);
-#endif
-}
-
-void
-PingusMain::on_exit_press()
-{
- std::cout << "Exit pressed" << std::endl;
- ScreenManager::instance()->clear();
-}
-
-void
-PingusMain::deinit_clanlib()
-{
-#if 0
- CL_SetupCore::deinit();
- CL_SetupGUI::deinit ();
-
- if (use_opengl)
- CL_SetupGL::deinit();
- else
- CL_SetupSDL::deinit();
-
- CL_SetupDisplay::deinit ();
-#endif
-}
-
-void
-PingusMain::init_pingus()
-{
- SavegameManager::instance();
- StatManager::init();
- Resource::init();
- Fonts::init();
- ScreenManager::init();
- PingusMenuManager::init();
- Sound::PingusSound::init();
- PinguActionFactory::init();
- Credits::init();
- WorldMapNS::WorldMapManager::instance();
-
-//// fps_counter.init();
- console.init();
-}
-
-void
-PingusMain::deinit_pingus()
-{
-//// fps_counter.deinit();
- console.deinit();
-
- Fonts::deinit();
- Credits::deinit();
- PinguActionFactory::deinit();
- Sound::PingusSound::deinit();
- PingusMenuManager::deinit();
- WorldObjFactory::deinit();
- WorldMapNS::WorldMapManager::deinit();
- ScreenManager::deinit();
- StatManager::deinit();
- SavegameManager::deinit();
- Resource::deinit();
-}
-
-int main(int argc, char** argv)
-{
- PingusMain app;
- return app.main(argc, argv);
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_main.hpp (from rev 2685,
branches/pingus_sdl/src/pingus_main.hxx)
Deleted: branches/pingus_sdl/src/pingus_main.hxx
===================================================================
--- branches/pingus_sdl/src/pingus_main.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingus_main.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,88 +0,0 @@
-// $Id: pingus_main.hxx,v 1.14 2003/10/18 12:11:30 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PINGUS_MAIN_HXX
-#define HEADER_PINGUS_PINGUS_MAIN_HXX
-
-#include <string>
-#include "pingus.hxx"
-#include "SDL.h"
-
-void segfault_handler(int);
-
-
-class PingusMain
-{
-private:
- bool blitter_test;
- bool no_config_file;
- bool show_credits;
- bool editor;
-
- /// the name of the exe: argv[0]
- std::string executable_name;
- std::string levelfile;
-
- /** Filename to which the level preview should be saved */
- std::string preview_file;
-
- std::string worldmapfile;
- std::string resolution;
- int refresh_rate;
-
-public:
- PingusMain();
- virtual ~PingusMain();
-
- virtual int main(int argc, char** argv);
- virtual char* get_title();
-
- void on_exit_press();
-private:
- /** After all subsystems have been inited, the screen will get
- setup, the game (the menu or a level, depending on
- command line flags) will start and the user will get
- controll. */
- void start_game();
-
- void check_args(int argc, char** argv);
- void quick_check_args(int argc, char** argv);
- void read_rc_file(void);
-
- void print_greeting_message();
-
- void init_clanlib();
- void deinit_clanlib();
-
- void init_sdl();
- void deinit_sdl();
-
- void init_pingus();
- void init_path_finder();
- void deinit_pingus();
-
- PingusMain (const PingusMain&);
- PingusMain& operator= (const PingusMain&);
-
-} app; // golbal class instance
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_menu.cpp (from rev 2685,
branches/pingus_sdl/src/pingus_menu.cxx)
Deleted: branches/pingus_sdl/src/pingus_menu.cxx
===================================================================
--- branches/pingus_sdl/src/pingus_menu.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingus_menu.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,280 +0,0 @@
-// $Id: pingus_menu.cxx,v 1.22 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <config.h>
-#include "gettext.h"
-#include "components/menu_button.hxx"
-#include "resource.hxx"
-#include "debug.hxx"
-#include "globals.hxx"
-#include "sound/sound.hxx"
-#include "stat_manager.hxx"
-#include "start_screen.hxx"
-#include "story_screen.hxx"
-#include "worldmap/worldmap.hxx"
-#include "worldmap/manager.hxx"
-#include "gui/screen_manager.hxx"
-#include "pingus_menu_manager.hxx"
-#include "gui/gui_manager.hxx"
-#include "plf_res_mgr.hxx"
-#include "path_manager.hxx"
-#include "file_dialog.hxx"
-#include "editor/editor_screen.hxx"
-
-
-PingusMenu::PingusMenu (PingusMenuManager* m)
- : PingusSubMenu (m),
- filedialog(0)
-{
- is_init = false;
-
- start_button = new MenuButton(this, Vector2i(Display::get_width() * 400 /
800,
- Display::get_height() * 450 / 600),
- Resource::load_sprite("core/menu/play_on"),
- _("Start"),
- _("..:: Start the game ::.."));
-
- quit_button = new MenuButton(this, Vector2i(Display::get_width() * 650 / 800,
- Display::get_height() * 450 / 600),
- Resource::load_sprite("core/menu/exit_on"),
- _("Exit"),
- _("..:: Bye, bye ::.."));
-
- contrib_button = new MenuButton(this, Vector2i(Display::get_width() * 150 /
800,
- Display::get_height() * 450 / 600),
-
Resource::load_sprite("core/menu/options_on"),
- _("Contrib\nLevels"),
- _("..:: Play User Build levels ::.."));
-
- story_button = new MenuButton(this, Vector2i(Display::get_width() * 400 /
800,
- Display::get_height() * 340 / 600),
- Resource::load_sprite("core/menu/credits_on"),
- _("Story"),
- _("..:: Start the story ::.."));
-
- multiplayer_button = new MenuButton(this, Vector2i(Display::get_width() *
150 / 800,
- Display::get_height() * 340 /
600),
-
Resource::load_sprite("core/menu/multi_on"),
- _("Multiplayer"),
- _("..:: Multiplayer Match ::.."));
-
- editor_button = new MenuButton(this, Vector2i(Display::get_width() * 400 /
800,
- Display::get_height() * 450 / 600),
- Resource::load_sprite("core/menu/create_on"),
- _("Level Editor"),
- _("..:: Create your own levels ::.."));
-}
-
-void
-PingusMenu::setup_main_menu()
-{
- gui_manager->remove(contrib_button);
- gui_manager->remove(story_button);
- gui_manager->remove(multiplayer_button);
- gui_manager->remove(editor_button);
-
- gui_manager->add(quit_button, false);
- gui_manager->add(start_button, false);
-}
-
-void
-PingusMenu::setup_game_menu()
-{
- gui_manager->remove(start_button);
-
- gui_manager->add(contrib_button, false);
- gui_manager->add(story_button, false);
- gui_manager->add(editor_button, false);
- // FIXME: Re-enable this next line once multiplayer functionality
- // is actually available.
-
- //gui_manager->add(multiplayer_button, false);
-}
-
-void
-PingusMenu::setup_contrib_menu()
-{
- if (filedialog)
- delete filedialog;
- filedialog = new FileDialog(this, ".pingus",
- path_manager.complete("levels/"), true);
- manager->push_menu (filedialog);
-}
-
-void
-PingusMenu::setup_worldmap_menu()
-{
- if (filedialog)
- delete filedialog;
- filedialog = new FileDialog(this, ".xml",
- path_manager.complete("worldmaps/"), true);
- manager->push_menu (filedialog);
-}
-
-void
-PingusMenu::preload ()
-{
- if (!is_init)
- {
- is_init = true;
-
- background = Resource::load_sprite("core/misc/logo");
- setup_main_menu();
- }
-}
-
-PingusMenu::~PingusMenu()
-{
- delete start_button;
- delete quit_button;
- delete contrib_button;
- delete story_button;
- delete multiplayer_button;
- delete editor_button;
- if (filedialog)
- delete filedialog;
-}
-
-void
-PingusMenu::do_quit()
-{
- get_manager ()->show_exit_menu ();
-}
-
-void
-PingusMenu::do_start(const std::string &filename)
-{ // Start the story or worldmap mode
- Sound::PingusSound::play_sound ("letsgo");
- WorldMapNS::WorldMapManager::instance()->load(filename);
-
- bool story_seen = false;
- StatManager::instance()->get_bool(WorldMapNS::WorldMapManager::instance()->
- get_worldmap()->get_shortname() +
"-startstory-seen", story_seen);
-
- if (!story_seen)
- ScreenManager::instance()->push_screen
- (new
StoryScreen(WorldMapNS::WorldMapManager::instance()->get_worldmap()->get_intro_story()),
true);
- else
-
ScreenManager::instance()->push_screen(WorldMapNS::WorldMapManager::instance());
-}
-
-void PingusMenu::do_contrib(const std::string &levelfile)
-{ // Launch the specified level - don't bother checking for it, it has to exist
- Sound::PingusSound::play_sound ("letsgo");
- ScreenManager::instance()->push_screen
- (new StartScreen(PLFResMgr::load_plf_from_filename(levelfile)),
- true);
-}
-
-void PingusMenu::do_edit()
-{ // Launch the level editor
- Sound::PingusSound::stop_music();
- ScreenManager::instance()->push_screen (new Editor::EditorScreen());
-}
-
-void
-PingusMenu::on_resize(int w, int h)
-{
- pout << "Width: " << w << " Height: " << h << std::endl;
-}
-
-void
-PingusMenu::on_escape_press ()
-{
- get_manager ()->show_exit_menu ();
-}
-
-void
-PingusMenu::draw_foreground(DrawingContext& gc)
-{
- if (gc.get_height() == 480)
- {
- gc.draw(background,
- Vector3f((gc.get_width()/2) - (background.get_width()/2),
- 20.0f));
- }
- else
- {
- gc.draw(background,
- Vector3f((gc.get_width()/2) - (background.get_width()/2),
- static_cast<float>(Display::get_height()/10)));
- }
-#ifdef OFFICIAL_PINGUS_BUILD
- gc.print_left(Fonts::pingus_small, 20.0f,
- static_cast<float>(Display::get_height()-100),
- "Pingus version "VERSION", Copyright (C) 2003 Ingo Ruhnke
<address@hidden>\n");
-#else
- gc.print_left(Fonts::pingus_small, 20.0f,
- static_cast<float>(Display::get_height()-100),
- "Pingus version "VERSION" (unofficial build), Copyright (C)
2003 Ingo Ruhnke <address@hidden>\n");
-#endif
- gc.print_left(Fonts::pingus_small, 20.0f,
- static_cast<float>(Display::get_height()-70),
- "Pingus comes with ABSOLUTELY NO WARRANTY. This is free
software, and you are welcome\n"
- "to redistribute it under certain conditions; see the file
COPYING for details.\n");
-}
-
-void
-PingusMenu::load(const std::string &file, const std::string &filemask)
-{
- // Level
- if (filemask == ".pingus")
- do_contrib(file);
- // Worldmap
- else if (filemask == ".xml")
- do_start(file);
- manager->pop_menu();
-}
-
-void
-PingusMenu::cancel()
-{
- manager->pop_menu();
-}
-
-void
-PingusMenu::on_click(MenuButton* button)
-{
- if (button == start_button)
- {
- setup_game_menu();
- }
- else if (button == quit_button)
- {
- do_quit();
- }
- else if (button == contrib_button)
- {
- setup_contrib_menu();
- }
- else if (button == story_button)
- {
- setup_worldmap_menu();
- }
- else if (button == multiplayer_button)
- {
- setup_main_menu();
- }
- else if (button == editor_button)
- {
- do_edit();
- }
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_menu.hpp (from rev 2685,
branches/pingus_sdl/src/pingus_menu.hxx)
Deleted: branches/pingus_sdl/src/pingus_menu.hxx
===================================================================
--- branches/pingus_sdl/src/pingus_menu.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingus_menu.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,99 +0,0 @@
-// $Id: pingus_menu.hxx,v 1.12 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PINGUS_MENU_HXX
-#define HEADER_PINGUS_PINGUS_MENU_HXX
-
-#include <vector>
-#include "fonts.hxx"
-#include "pingus_sub_menu.hxx"
-#include "file_dialog_listener.hxx"
-#include "layer_manager.hxx"
-
-class SurfaceButton;
-class GameDelta;
-class FileDialog;
-
-namespace GUI {
-class GUIManager;
-} // namespace GUI
-
-class MenuButton;
-
-class PingusMenu : public PingusSubMenu, public FileDialogListener
-{
-public:
- bool is_init;
-private:
- Sprite background;
- LayerManager layer_manager;
-
- MenuButton* start_button;
- MenuButton* quit_button;
-
- MenuButton* contrib_button;
- MenuButton* story_button;
- MenuButton* multiplayer_button;
- MenuButton* editor_button;
- FileDialog* filedialog;
-
- void on_resize (int w, int h);
-
- // These functions setup the different menus
- void setup_main_menu();
- void setup_game_menu();
- /** Show the levels folder */
- void setup_contrib_menu();
- /** Show the worldmap folder */
- void setup_worldmap_menu();
-
- /** Quit the game */
- void do_quit();
- /** Start the story/worldmap mode */
- void do_start(const std::string &filename);
- /** Start the level editor */
- void do_edit();
-
- /** Use this to load the level or worldmap */
- virtual void load(const std::string &file, const std::string &filemask);
-
- /** Cancels the file dialog box */
- virtual void cancel();
-
-public:
- PingusMenu (PingusMenuManager* m);
- ~PingusMenu();
-
- void on_click(MenuButton* button);
-
- /// Load all images and other stuff for the menu
- void preload ();
- void do_contrib(const std::string&);
-
- void on_escape_press ();
- void draw_foreground(DrawingContext& gc);
-private:
- PingusMenu (const PingusMenu&);
- PingusMenu& operator= (const PingusMenu&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_menu_manager.cpp (from rev 2685,
branches/pingus_sdl/src/pingus_menu_manager.cxx)
Deleted: branches/pingus_sdl/src/pingus_menu_manager.cxx
===================================================================
--- branches/pingus_sdl/src/pingus_menu_manager.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/pingus_menu_manager.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,171 +0,0 @@
-// $Id: pingus_menu_manager.cxx,v 1.29 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "gui/screen_manager.hxx"
-#include "sound/sound.hxx"
-#include "resource.hxx"
-#include "blitter.hxx"
-#include "pingus_menu_manager.hxx"
-
-
-PingusMenuManager* PingusMenuManager::instance_ = 0;
-
-PingusMenuManager::PingusMenuManager ()
- : mainmenu (this),
- exitmenu (this)
-{
- int w = Display::get_width();
- int h = Display::get_height();
- // We only need to scale the background main menu images if the screen
- // resolution is not default
- if (w != 800 && h != 600)
- {
-#if 0
- background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_pixelbuffer("core/menu/layer1"), w, 185
* h / 600), 0, 0, 12, 0);
- background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_pixelbuffer("core/menu/layer2"), w, 362
* h / 600), 0, 150 * (float)h / 600, 25, 0);
- background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_pixelbuffer("core/menu/layer3"), w, 306
* h / 600), 0, 200 * (float)h / 600, 50, 0);
- background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_pixelbuffer("core/menu/layer4"), w, 171
* h / 600), 0, 429 * (float)h / 600, 100, 0);
- background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_pixelbuffer("core/menu/layer5"), 302 * w
/ 800, 104 * h / 600), 0, 500 * (float)h / 600, 200, 0);
-#endif
- }
- else
- {
- background.add_layer(Resource::load_sprite("core/menu/layer1"),
0, 0, 12, 0);
- background.add_layer(Resource::load_sprite("core/menu/layer2"),
0, 150, 25, 0);
- background.add_layer(Resource::load_sprite("core/menu/layer3"),
0, 200, 50, 0);
- background.add_layer(Resource::load_sprite("core/menu/layer4"),
0, 429, 100, 0);
- background.add_layer(Resource::load_sprite("core/menu/layer5"),
0, 500, 200, 0);
- }
- push_menu (&mainmenu);
-}
-
-PingusMenuManager::~PingusMenuManager ()
-{
-}
-
-bool
-PingusMenuManager::draw (DrawingContext& gc)
-{
- background.draw(gc);
-
- gc.draw_fillrect(0.0,
- static_cast<float>(Display::get_height () - 22),
- static_cast<float>(Display::get_width ()),
- static_cast<float>(Display::get_height ()),
- Color(0, 0, 0, 255));
-
- for (MenuStackIter i = menu_stack.begin (); i != menu_stack.end (); ++i)
- (*i)->draw(gc);
-
- return true;
-}
-
-void
-PingusMenuManager::update (const GameDelta& delta)
-{
- background.update (delta.get_time ());
- menu_stack.back()->update (delta);
-}
-
-void
-PingusMenuManager::set_menu (PingusSubMenu * menu)
-{
- pop_menu ();
- push_menu (menu);
-}
-
-void
-PingusMenuManager::push_menu (PingusSubMenu * menu)
-{
- menu->preload ();
- menu_stack.push_back (menu);
-}
-
-void
-PingusMenuManager::pop_menu ()
-{
- if (!menu_stack.empty ())
- menu_stack.pop_back();
-}
-
-PingusSubMenu *
-PingusMenuManager::current_menu ()
-{
- if (!menu_stack.empty ())
- {
- MenuStackRIter i = menu_stack.rbegin ();
- if (! *i)
- std::cout << "PingusMenuManager: Error: current_menu is " << *i <<
std::endl;
- return *i;
- }
- else
- {
- std::cout << "PingusMenuManager: Error: MenuStack empty!" << std::endl;
- return 0;
- }
-}
-
-void
-PingusMenuManager::show_exit_menu ()
-{
- push_menu (&exitmenu);
-}
-
-void
-PingusMenuManager::exit ()
-{
- //std::cout << "poping PingusMenuManager" << std::endl;
- ScreenManager::instance ()->pop_screen ();
-}
-
-void
-PingusMenuManager::on_startup()
-{
- Sound::PingusSound::play_music("pingus-1.it");
-}
-
-PingusMenuManager*
-PingusMenuManager::instance ()
-{
- if (instance_)
- return instance_;
- else
- return instance_ = new PingusMenuManager ();
-}
-
-void
-PingusMenuManager::init()
-{
- instance_ = 0;
-}
-
-void
-PingusMenuManager::deinit()
-{
- delete instance_;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_menu_manager.hpp (from rev 2685,
branches/pingus_sdl/src/pingus_menu_manager.hxx)
Deleted: branches/pingus_sdl/src/pingus_menu_manager.hxx
===================================================================
--- branches/pingus_sdl/src/pingus_menu_manager.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/pingus_menu_manager.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,91 +0,0 @@
-// $Id: pingus_menu_manager.hxx,v 1.22 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PINGUS_MENU_MANAGER_HXX
-#define HEADER_PINGUS_PINGUS_MENU_MANAGER_HXX
-
-#include "layer_manager.hxx"
-#include "exit_menu.hxx"
-#include "pingus_menu.hxx"
-#include "file_dialog.hxx"
-
-class PingusSubMenu;
-
-class PingusMenuManager : public Screen
-{
-private:
- static PingusMenuManager* instance_;
- /** Menu stack. the menu on top is .end (), the bottom menu .begin () */
- std::vector<PingusSubMenu *> menu_stack;
- typedef std::vector<PingusSubMenu *>::iterator MenuStackIter;
- typedef std::vector<PingusSubMenu *>::reverse_iterator MenuStackRIter;
-
- /// Register all event-handling stuff
- void register_events ();
-
- /// Unregister all event-handling stuff
- void unregister_events ();
-public:
- /* Menu's FIXME: These shouldn't get exported to the outsite,
- instead only handles (enum's) should be visible */
- PingusMenu mainmenu;
- LayerManager background;
- ExitMenu exitmenu;
-
- virtual ~PingusMenuManager();
-
- bool draw(DrawingContext& gc);
- void update(const GameDelta&);
-
- /// Exit the menu manager (which means to exit the while() loop in display
())
- void show_exit_menu ();
-
- void exit ();
-
- PingusSubMenu * current_menu();
-
- // Replace the current menu with a new one
- void set_menu (PingusSubMenu * menu);
-
- /** Remove the current menu and fall back to the last one.
- This is used for yes/no dialoges and such things. */
- void pop_menu();
-
- /** Add's a new menu to the menu stack. This is used for yes/no
- dialoges and such things.*/
- void push_menu (PingusSubMenu * menu);
-
- void on_startup();
-
- static PingusMenuManager* instance ();
- static void init();
- static void deinit();
-
-protected:
- PingusMenuManager ();
-
-private:
- PingusMenuManager (const PingusMenuManager&);
- PingusMenuManager& operator= (const PingusMenuManager&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_sub_menu.cpp (from rev 2685,
branches/pingus_sdl/src/pingus_sub_menu.cxx)
Deleted: branches/pingus_sdl/src/pingus_sub_menu.cxx
===================================================================
--- branches/pingus_sdl/src/pingus_sub_menu.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingus_sub_menu.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,33 +0,0 @@
-// $Id: pingus_sub_menu.cxx,v 1.2 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "pingus_sub_menu.hxx"
-
-
-PingusSubMenu::PingusSubMenu (PingusMenuManager* m)
- : manager (m)
-{
-}
-
-PingusSubMenu::~PingusSubMenu ()
-{
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/pingus_sub_menu.hpp (from rev 2685,
branches/pingus_sdl/src/pingus_sub_menu.hxx)
Deleted: branches/pingus_sdl/src/pingus_sub_menu.hxx
===================================================================
--- branches/pingus_sdl/src/pingus_sub_menu.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/pingus_sub_menu.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,54 +0,0 @@
-// $Id: pingus_sub_menu.hxx,v 1.10 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PINGUS_SUB_MENU_HXX
-#define HEADER_PINGUS_PINGUS_SUB_MENU_HXX
-
-#include "gui/gui_screen.hxx"
-
-class CL_Key;
-class CL_InputDevice;
-
-
-class PingusMenuManager;
-
-class PingusSubMenu : public GUIScreen
-{
-protected:
- PingusMenuManager* manager;
-
-public:
- PingusSubMenu (PingusMenuManager* m);
- virtual ~PingusSubMenu ();
-
- /// load all the data which is needed for the menu
- virtual void preload () =0;
-
- /// Return a handle to the parent menu manager
- PingusMenuManager* get_manager () { return manager; }
-
-private:
- PingusSubMenu (const PingusSubMenu&);
- PingusSubMenu& operator= (const PingusSubMenu&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/plf_res_mgr.cpp (from rev 2685,
branches/pingus_sdl/src/plf_res_mgr.cxx)
Deleted: branches/pingus_sdl/src/plf_res_mgr.cxx
===================================================================
--- branches/pingus_sdl/src/plf_res_mgr.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/plf_res_mgr.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,103 +0,0 @@
-// $Id: plf_res_mgr.cxx,v 1.8 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "globals.hxx"
-#include "debug.hxx"
-#include "system.hxx"
-#include "path_manager.hxx"
-#include "xml_pingus_level.hxx"
-#include "plf_res_mgr.hxx"
-
-
-PLFResMgr::PLFMap PLFResMgr::plf_map;
-
-PingusLevel
-PLFResMgr::load_plf_raw(const std::string& res_name,
- const std::string& filename)
-{
- std::cout << "PLFResMgr: '" << res_name << "' -> '" << filename << "'" <<
std::endl;
-
- PLFMap::iterator i = plf_map.find(res_name);
-
- if (i == plf_map.end())
- { // Entry not cached, so load it and add it to cache
- pout(PINGUS_DEBUG_LOADING) << "PLFResMgr: Loading level from DISK: '" <<
res_name << "' -> '" << filename << "'" << std::endl;
-
- PingusLevel plf(res_name, filename);
-
- PLFEntry entry;
- entry.plf = plf;
- entry.mtime = System::get_mtime(filename);
-
- plf_map[res_name] = entry;
-
- // FIXME: leaking pointers to the outsite work is not such a good
- // idea, could lead to throuble sooner or later
-
- return PingusLevel (entry.plf);
- }
- else
- {
- unsigned int current_mtime = System::get_mtime(filename);
- if (current_mtime != i->second.mtime)
- {
- pout(PINGUS_DEBUG_LOADING) << "PLFResMgr: level changed on DISK,
reloading: '" << res_name << "' -> '" << filename << "'" << std::endl;
-
- // Reload the file since it has changed on disk
- PingusLevel plf(res_name, filename);
- PLFEntry entry;
-
- entry.plf = plf;
- entry.mtime = System::get_mtime(filename);
-
- plf_map[res_name] = entry;
-
- // FIXME: leaking pointers to the outsite work is not such a good
- // idea, could lead to throuble sooner or later
- return PingusLevel (entry.plf);
- }
- else
- { // File in cache is up to date, everything is already, return it
- pout(PINGUS_DEBUG_LOADING) << "PLFResMgr: Loading level from CACHE:
'" << res_name << "' -> '" << filename << "'" << std::endl;
-
- return i->second.plf;
- }
- }
-}
-
-PingusLevel
-PLFResMgr::load_plf_from_filename(const std::string& filename)
-{
- std::string res_name = System::basename(filename);
-
- // This should give us the tutorial/, wip/, etc. part of the res_name
- std::string dirname = System::basename(System::dirname(filename));
-
- return load_plf_raw(dirname + "/" + res_name.substr(0, res_name.length()-4),
- filename);
-}
-
-PingusLevel
-PLFResMgr::load_plf(const std::string& res_name)
-{
- return load_plf_raw(res_name, path_manager.complete("levels/" + res_name +
".pingus"));
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/plf_res_mgr.hpp (from rev 2685,
branches/pingus_sdl/src/plf_res_mgr.hxx)
Deleted: branches/pingus_sdl/src/plf_res_mgr.hxx
===================================================================
--- branches/pingus_sdl/src/plf_res_mgr.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/plf_res_mgr.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,58 +0,0 @@
-// $Id: plf_res_mgr.hxx,v 1.6 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PLF_RES_MGR_HXX
-#define HEADER_PINGUS_PLF_RES_MGR_HXX
-
-#include "pingus_level.hxx"
-
-
-/** */
-class PLFResMgr
-{
-private:
- struct PLFEntry {
- PingusLevel plf;
- unsigned int mtime;
- };
-
- typedef std::map<std::string, PLFEntry> PLFMap;
- static PLFMap plf_map;
- /** Loads PLF from filename and stores it under 'res_name' in the
- map */
- static PingusLevel load_plf_raw(const std::string& res_name,
- const std::string& filename);
-public:
- /** @returns a handle to the PLF, which the caller *must not* delete
-
- @param res_name The resource name of the level, aka "snow11-grumbel"
- */
- static PingusLevel load_plf(const std::string& res_name);
-
- /** @return a handle to the PLF, instead of loading it from a
- res_name, load it from a system dependend filename
-
- @param filename The filename of the plf, aka
"../data/levels/snow11-grumbel.pingus" */
- static PingusLevel load_plf_from_filename(const std::string& filename);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/plt_xml.cpp (from rev 2685,
branches/pingus_sdl/src/plt_xml.cxx)
Deleted: branches/pingus_sdl/src/plt_xml.cxx
===================================================================
--- branches/pingus_sdl/src/plt_xml.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/plt_xml.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,81 +0,0 @@
-// $Id: plt_xml.cxx,v 1.13 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <ClanLib/core.h>
-#include "globals.hxx"
-#include "pingus_error.hxx"
-//#include "xml_file_reader.hxx"
-#include "plt_xml.hxx"
-
-
-PLTXML::PLTXML ()
-{
-}
-
-PLTXML::~PLTXML ()
-{
-}
-
-
-void
-PLTXML::parse (std::string filename)
-{
- CL_DomDocument doc(new CL_InputSource_File(filename), true);
-
- CL_DomElement root = doc.get_document_element();
-
- if (root.get_tag_name() != "pingus-level")
- {
- PingusError::raise("Error: " + filename + ": not a <pingus-world> file");
- }
- else
- {
- XMLFileReader reader(root);
- reader.read_string("name", world_name);
- reader.read_string("description", description);
- //reader.read_desc ("background", background_desc);
-
- FileReader levelreader;
- reader.read_section("level-list", levelreader);
- /** FIXME: Insert code here for parsing <level> tags */
- }
-}
-
-std::vector<std::string>
-PLTXML::get_levels ()
-{
- return level_list;
-}
-
-const std::string&
-PLTXML::get_name ()
-{
- return world_name;
-}
-
-const std::string&
-PLTXML::get_description ()
-{
-
- return description;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/plt_xml.hpp (from rev 2685,
branches/pingus_sdl/src/plt_xml.hxx)
Deleted: branches/pingus_sdl/src/plt_xml.hxx
===================================================================
--- branches/pingus_sdl/src/plt_xml.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/plt_xml.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,54 +0,0 @@
-// $Id: plt_xml.hxx,v 1.9 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PLT_XML_HXX
-#define HEADER_PINGUS_PLT_XML_HXX
-
-#include <vector>
-#include <string>
-
-
-class PLTXML
-{
-private:
- std::vector<std::string> level_list;
- std::string world_name;
- std::string description;
-
- void parse_file();
-
-public:
- PLTXML ();
- ~PLTXML ();
-
- void parse (std::string filename);
-
- const std::string& get_name ();
- const std::string& get_description ();
- std::vector<std::string> get_levels ();
-
-private:
- PLTXML (const PLTXML&);
- PLTXML& operator= (const PLTXML&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/preview_renderer.cpp (from rev 2685,
branches/pingus_sdl/src/preview_renderer.cxx)
Deleted: branches/pingus_sdl/src/preview_renderer.cxx
===================================================================
--- branches/pingus_sdl/src/preview_renderer.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/preview_renderer.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,41 +0,0 @@
-// $Id: preview_renderer.cxx,v 1.2 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "world.hxx"
-//#include "gui/buffer_graphic_context.hxx"
-#include "preview_renderer.hxx"
-
-
-void
-PreviewRenderer::render(const PingusLevel& plf,
- const std::string& output_file)
-{
-#if 0 // FIXME:
- std::cout << "PreviewRenderer::render: " << output_file << std::endl;
- World* world = new World(*plf);
- BufferDrawingContext buffer(world->get_width(), world->get_height());
- world->draw(buffer);
- buffer.write(output_file);
- delete world;
-#endif
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/preview_renderer.hpp (from rev 2685,
branches/pingus_sdl/src/preview_renderer.hxx)
Deleted: branches/pingus_sdl/src/preview_renderer.hxx
===================================================================
--- branches/pingus_sdl/src/preview_renderer.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/preview_renderer.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,45 +0,0 @@
-// $Id: preview_renderer.hxx,v 1.2 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PREVIEW_RENDERER_HXX
-#define HEADER_PREVIEW_RENDERER_HXX
-
-#include "plf_res_mgr.hxx"
-
-
-/** By given a PLF, the PreviewRenderer renders a CL_Canvas with a
- graphic of the complete level, it also allows to save it down to a
- file */
-class PreviewRenderer
-{
-private:
-public:
- /** Render the level given by levelfile to as pnm to the file given
- * by output_file
- *
- * @param plf PLF that describes the level
- * @param output_file filename of the file to which the result should be
written
- */
- static void render(const PingusLevel& plf, const std::string& output_file);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/res_descriptor.cpp (from rev 2685,
branches/pingus_sdl/src/res_descriptor.cxx)
Deleted: branches/pingus_sdl/src/res_descriptor.cxx
===================================================================
--- branches/pingus_sdl/src/res_descriptor.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/res_descriptor.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,58 +0,0 @@
-// $Id: res_descriptor.cxx,v 1.18 2003/10/20 19:28:54 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include <iostream>
-#include "res_descriptor.hxx"
-#include "pingus_error.hxx"
-
-
-/*
- uri -> file:///home/ingo/.pingus/images/...
- uri -> resource://core/result/ok
- uri -> file://bla.png (relative to ~/.pingus/images/)
- ResDescriptor(const std::string& uri);
-*/
-
-ResDescriptor::ResDescriptor()
-{
- res_name = "";
- modifier = ResourceModifierNS::ROT0;
-}
-
-ResDescriptor::ResDescriptor(const std::string& arg_res_name,
- ResourceModifierNS::ResourceModifier arg_modifier)
-{
- res_name = arg_res_name;
- modifier = arg_modifier;
-}
-
-bool
-ResDescriptor::operator<(const ResDescriptor& res_desc) const
-{
- return (res_name < res_desc.res_name) && (modifier < res_desc.modifier);
-}
-
-std::ostream& operator<<(std::ostream& s, const ResDescriptor& desc)
-{
- return s << "[" << desc.res_name << ", "
- << ResourceModifierNS::rs_to_string(desc.modifier) << "]";
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/res_descriptor.hpp (from rev 2685,
branches/pingus_sdl/src/res_descriptor.hxx)
Deleted: branches/pingus_sdl/src/res_descriptor.hxx
===================================================================
--- branches/pingus_sdl/src/res_descriptor.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/res_descriptor.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,46 +0,0 @@
-// $Id: res_descriptor.hxx,v 1.14 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_RES_DESCRIPTOR_HXX
-#define HEADER_PINGUS_RES_DESCRIPTOR_HXX
-
-#include "resource_modifier.hxx"
-
-/// Resource descriptor, tells were to find a resource.
-class ResDescriptor
-{
-public:
- /// The name of the data, filename or resourcename ("textures/desert")
- std::string res_name;
-
- ResourceModifierNS::ResourceModifier modifier;
-
- ResDescriptor ();
- ResDescriptor (const std::string& res_name,
- ResourceModifierNS::ResourceModifier modifier =
ResourceModifierNS::ROT0);
-
- bool operator< (const ResDescriptor&) const;
-};
-
-/// Our own function to print out the ResDescriptor
-std::ostream& operator<<(std::ostream& s, const ResDescriptor& desc);
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/resource.cpp (from rev 2685,
branches/pingus_sdl/src/resource.cxx)
Deleted: branches/pingus_sdl/src/resource.cxx
===================================================================
--- branches/pingus_sdl/src/resource.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/resource.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,367 +0,0 @@
-// $Id: resource.cxx,v 1.36 2003/12/13 16:23:39 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef WIN32
-# include <unistd.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-#endif
-
-#include <assert.h>
-
-#include "system.hxx"
-#include "path_manager.hxx"
-#include "globals.hxx"
-#include "resource.hxx"
-#include "blitter.hxx"
-#include "debug.hxx"
-
-ResourceManager Resource::resmgr;
-#if 0
-std::map<ResDescriptor, CL_Surface> Resource::surface_map;
-#endif
-
-void
-Resource::init()
-{
- resmgr.add_resources(path_manager.complete("data/core.res"));
- resmgr.add_resources(path_manager.complete("data/entrances.res"));
- resmgr.add_resources(path_manager.complete("data/exits.res"));
- //// resmgr.add_resources(path_manager.complete("data/fonts.res"));
- resmgr.add_resources(path_manager.complete("data/game.res"));
- resmgr.add_resources(path_manager.complete("data/groundpieces-bridge.res"));
- resmgr.add_resources(path_manager.complete("data/groundpieces-ground.res"));
- resmgr.add_resources(path_manager.complete("data/groundpieces-remove.res"));
- resmgr.add_resources(path_manager.complete("data/groundpieces-solid.res"));
-
resmgr.add_resources(path_manager.complete("data/groundpieces-transparent.res"));
- resmgr.add_resources(path_manager.complete("data/hotspots.res"));
- resmgr.add_resources(path_manager.complete("data/liquids.res"));
- resmgr.add_resources(path_manager.complete("data/pingus-player0.res"));
- resmgr.add_resources(path_manager.complete("data/pingus-player1.res"));
- resmgr.add_resources(path_manager.complete("data/pingus-player2.res"));
- resmgr.add_resources(path_manager.complete("data/pingus-player3.res"));
- resmgr.add_resources(path_manager.complete("data/pingus-common.res"));
- resmgr.add_resources(path_manager.complete("data/particles.res"));
- resmgr.add_resources(path_manager.complete("data/story.res"));
- resmgr.add_resources(path_manager.complete("data/textures.res"));
- resmgr.add_resources(path_manager.complete("data/traps.res"));
- resmgr.add_resources(path_manager.complete("data/worldmaps.res"));
- resmgr.add_resources(path_manager.complete("data/worldobjs.res"));
- resmgr.add_resources(path_manager.complete("data/alias.res"));
-}
-
-// Returns all resources in the given section
-#if 0
-std::vector<std::string>
-Resource::get_resources(const std::string& type, const std::string& section)
-{
- if (section == "")
- return resmgr.get_resources_of_type(type);
- else
- return resmgr.get_resources_of_type(type, section);
-}
-
-// Returns a list of sections. Returns all sections if left blank.
-std::vector<std::string>
-Resource::get_sections(const std::string& section)
-{
- if (section == std::string())
- return resmgr.get_all_sections();
- else
- return resmgr.get_sections(section);
-}
-#endif
-
-void
-Resource::deinit()
-{
- cleanup();
-#if 0
- surface_map.clear();
-#endif
-}
-
-#if 0
-CL_Surface
-Resource::load_surface(const std::string& res_name,
- ResourceModifierNS::ResourceModifier modifier)
-{
- return load_surface(ResDescriptor(res_name, modifier));
-}
-#endif
-
-Sprite
-Resource::load_sprite(const ResDescriptor& desc)
-{
- return load_sprite(desc.res_name);
-}
-
-Sprite
-Resource::load_sprite(const std::string& res_name)
-{
- SpriteDescription* desc = resmgr.get_sprite_description(res_name);
- if (desc)
- return Sprite(*desc);
- else
- return Sprite();
-
-#if 0
- try {
- return CL_Sprite(res_name, &resmgr);
- } catch (CL_Error& err) {
- std::cout << "Resource::load_sprite: CL_Error: '" << res_name << "'" <<
std::endl;
- std::cout << "CL_Error: " << err.message << std::endl;
- return CL_Sprite("core/misc/404sprite", &resmgr);
- }
-#endif
-}
-
-CollisionMask
-Resource::load_collision_mask(const std::string& name)
-{
- return CollisionMask(name);
-}
-
-PixelBuffer
-Resource::load_pixelbuffer(const ResDescriptor& desc_)
-{
- return PixelBuffer(desc_.res_name);
-#if 0
- CL_SpriteDescription desc = load_sprite_desc(desc_.res_name);
-
- if (desc.get_frames().size() == 0)
- {
- std::cout << "Error: load_pixelbuffer: " << desc_.res_name << std::endl;
- assert(0);
- }
-
- return apply_modifier_to_pixelbuffer(desc.get_frames().begin()->first,
desc_);
-#endif
-}
-
-PixelBuffer
-Resource::load_pixelbuffer(const std::string& res_name)
-{
- return load_pixelbuffer(ResDescriptor(res_name));
-}
-
-#if 0
-CL_Surface
-Resource::load_surface(const ResDescriptor& res_desc)
-{
- // try to load from cache
- CL_Surface surf = load_from_cache(res_desc);
-
- if (!surf) // not in cache
- {
- ResDescriptor desc = res_desc;
- desc.modifier = ResourceModifierNS::ROT0;
-
- // Try to an unmodified version from cache
- surf = load_from_cache(desc);
-
- if (surf) // found unmodified version in cache
- {
- pout(PINGUS_DEBUG_RESOURCES) << "Resource: Loading surface from cache
1/2: " << res_desc << std::endl;
- surf = apply_modifier (surf, res_desc);
-
- surface_map[res_desc] = surf;
- }
- else // never loaded, need to load it from source
- {
- desc = res_desc;
- desc.modifier = ResourceModifierNS::ROT0;
-
- pout(PINGUS_DEBUG_RESOURCES) << "Resource: Loading surface from
source: " << res_desc << std::endl;
- surf = load_from_source (desc);
- surface_map[desc] = surf; // add to cache
-
- surf = apply_modifier (surf, res_desc);
- surface_map[res_desc] = surf; // add modified version to cache
- }
- }
- else
- {
- pout(PINGUS_DEBUG_RESOURCES) << "Resource: Loading surface from cache: "
<< res_desc << std::endl;
- }
-
- return surf;
-}
-
-CL_Surface
-Resource::load_from_cache (const ResDescriptor& res_desc)
-{
- std::map<ResDescriptor, CL_Surface>::iterator i = surface_map.find(res_desc);
- if (i == surface_map.end())
- {
- return CL_Surface();
- }
- else
- {
- return i->second;
- }
-}
-
-PixelBuffer
-Resource::apply_modifier_to_pixelbuffer(PixelBuffer prov, const ResDescriptor&
res_desc)
-{
- switch (res_desc.modifier)
- {
- case ResourceModifierNS::ROT0:
- return prov;
-
- case ResourceModifierNS::ROT90:
- return Blitter::rotate_90(prov);
-
- case ResourceModifierNS::ROT180:
- return Blitter::rotate_180(prov);
-
- case ResourceModifierNS::ROT270:
- return Blitter::rotate_270(prov);
-
- case ResourceModifierNS::ROT0FLIP:
- return Blitter::flip_horizontal(prov);
-
- case ResourceModifierNS::ROT90FLIP:
- return Blitter::rotate_90_flip(prov);
-
- case ResourceModifierNS::ROT180FLIP:
- return Blitter::rotate_180_flip(prov);
-
- case ResourceModifierNS::ROT270FLIP:
- return Blitter::rotate_270_flip(prov);
-
- default:
- perr << "Resource: Unhandled modifier: " << res_desc.modifier <<
std::endl;
- return prov;
- }
-}
-
-CL_Surface
-Resource::apply_modifier (const CL_Surface& surf, const ResDescriptor&
res_desc)
-{
- PixelBuffer prov = surf.get_pixeldata();
-
- switch (res_desc.modifier)
- {
- case ResourceModifierNS::ROT0:
- return CL_Surface(prov);
-
- case ResourceModifierNS::ROT90:
- return CL_Surface(Blitter::rotate_90(prov));
-
- case ResourceModifierNS::ROT180:
- return CL_Surface(Blitter::rotate_180(prov));
-
- case ResourceModifierNS::ROT270:
- return CL_Surface(Blitter::rotate_270(prov));
-
- case ResourceModifierNS::ROT0FLIP:
- return CL_Surface(Blitter::flip_horizontal(prov));
-
- case ResourceModifierNS::ROT90FLIP:
- return CL_Surface(Blitter::rotate_90_flip(prov));
-
- case ResourceModifierNS::ROT180FLIP:
- return CL_Surface(Blitter::rotate_180_flip(prov));
-
- case ResourceModifierNS::ROT270FLIP:
- return CL_Surface(Blitter::rotate_270_flip(prov));
-
- default:
- perr << "Resource: Unhandled modifier: " << res_desc.modifier <<
std::endl;
- return CL_Surface(prov);
- }
-}
-
-CL_Surface
-Resource::load_from_source (const ResDescriptor& res_desc)
-{
- try {
- return CL_Surface(res_desc.res_name, &resmgr);
- } catch (CL_Error err) {
- pout << "CL_Error: " << err.message << std::endl;
- pout << "Resource:" << res_desc
- << ":-404-:" << err.message << std::endl;
- try {
- return CL_Surface ("core/misc/404", &resmgr);
- } catch (CL_Error err2) {
- pout << "Resource: Fatal error, important gfx files (404.pcx) couldn't
be loaded!" << std::endl;
- throw err;
- }
- }
-}
-#endif
-
-Font
-Resource::load_font(const std::string& res_name)
-{
- ////return Font(res_name, &resmgr);
- return Font();
-}
-
-void
-Resource::cleanup ()
-{
-#if 0
- CL_Resource res;
- std::vector<std::string> resources = resmgr.get_all_resources();
- for (std::vector<std::string>::iterator i = resources.begin(); i !=
resources.end(); i++)
- {
- res = resmgr.get_resource(*i);
- while (res.get_reference_count() > 0)
- res.unload();
- }
-#endif
-}
-
-unsigned int
-Resource::get_mtime (const std::string& res_name)
-{
- /*
- try
- {
- CL_ResourceManager res_man = Resource::get(datafile);
-
- CL_Resource& res = res_man->get_resource(res_name);
-
- std::string filename = res.get_full_location();
-
- #ifndef WIN32
- struct stat stat_buf;
- if (stat(filename.c_str(), &stat_buf) == 0)
- return stat_buf.st_mtime;
- else
- return 0;
- #else
- // FIXME: Win32 mtime getter not implemented
- return 0;
- }
- catch (CL_Error& err)
- {
- std::cout << "Resource::get_mtime: CL_Error: " << err.message << std::endl;
- return 0;
- }
- #endif
- */
- return 0;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/resource.hpp (from rev 2685,
branches/pingus_sdl/src/resource.hxx)
Deleted: branches/pingus_sdl/src/resource.hxx
===================================================================
--- branches/pingus_sdl/src/resource.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/resource.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,95 +0,0 @@
-// $Id: resource.hxx,v 1.19 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_RESOURCE_HXX
-#define HEADER_PINGUS_RESOURCE_HXX
-
-#include <map>
-#include <vector>
-#include "sprite.hpp"
-#include "pixel_buffer.hpp"
-#include "res_descriptor.hxx"
-#include "resource_manager.hpp"
-#include "collision_mask.hpp"
-#include "font.hpp"
-
-class CL_ResourceManager;
-
-/** General Resource Managing class, it provides wrappers around
- CL_Surface::load(), CL_Font::load() and friends. This class is
- needed to do a better handling of the resources. */
-class Resource
-{
-public:
- static ResourceManager resmgr;
-#if 0
- static std::map<ResDescriptor, CL_Surface> surface_map;
-
- static CL_Surface load_from_source (const ResDescriptor& res_desc);
- static CL_Surface load_from_cache (const ResDescriptor& res_desc);
- static CL_Surface apply_modifier (const CL_Surface&, const ResDescriptor&
res_desc);
- static PixelBuffer apply_modifier_to_pixelbuffer(PixelBuffer, const
ResDescriptor& res_desc);
-
- /** Returns a list of resources for the given section.
- Returns all if blank */
- static std::vector<std::string> get_resources(const std::string &type,
- const std::string §ion =
"");
-
- /** Returns a list of sections under the given section.
- Returns all sections if blank */
- static std::vector<std::string> get_sections(const std::string §ion =
std::string());
-#endif
-
-public:
- static void init();
- static void deinit();
-
- /** */
- static unsigned int get_mtime (const std::string& res_name);
-
-#if 0
- /** Load a surface with res_name from datafile */
- static CL_Surface load_surface(const std::string& res_name,
- ResourceModifierNS::ResourceModifier modifier
- = ResourceModifierNS::ROT0);
-
- /** Load a surface from the ResDescriptor */
- static CL_Surface load_surface(const ResDescriptor&);
-#endif
- static Sprite load_sprite(const ResDescriptor&);
- static Sprite load_sprite(const std::string& res_name);
- static CollisionMask load_collision_mask(const std::string& res_name);
- static PixelBuffer load_pixelbuffer(const std::string& res_name);
- static PixelBuffer load_pixelbuffer(const ResDescriptor&);
-
- /** Load a font with res_name from datafile */
- static Font load_font(const std::string& res_name);
-
- /** Cleanup all currently unused surfaces */
- static void cleanup ();
-
-private:
- Resource (const Resource&);
- Resource& operator= (const Resource&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/resource_modifier.cpp (from rev 2685,
branches/pingus_sdl/src/resource_modifier.cxx)
Deleted: branches/pingus_sdl/src/resource_modifier.cxx
===================================================================
--- branches/pingus_sdl/src/resource_modifier.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/resource_modifier.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,182 +0,0 @@
-// $Id: resource_modifier.cxx,v 1.4 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include "resource_modifier.hxx"
-
-namespace ResourceModifierNS {
-
-ResourceModifier horizontal_flip (ResourceModifier modifier)
-{
- switch (modifier)
- {
- case ROT0:
- return ROT0FLIP;
- case ROT90:
- return ROT90FLIP;
- case ROT180:
- return ROT180FLIP;
- case ROT270:
- return ROT270FLIP;
- case ROT0FLIP:
- return ROT0;
- case ROT90FLIP:
- return ROT90;
- case ROT180FLIP:
- return ROT180;
- case ROT270FLIP:
- return ROT270;
- default:
- assert (0);
- return ROT0;
- }
-}
-
-ResourceModifier vertical_flip (ResourceModifier modifier)
-{
- switch (modifier)
- {
- case ROT0:
- return ROT180FLIP;
- case ROT90:
- return ROT270FLIP;
- case ROT180:
- return ROT0FLIP;
- case ROT270:
- return ROT90FLIP;
- case ROT0FLIP:
- return ROT180;
- case ROT90FLIP:
- return ROT270;
- case ROT180FLIP:
- return ROT0;
- case ROT270FLIP:
- return ROT90;
- default:
- assert (0);
- return ROT0;
- }
-}
-
-ResourceModifier rotate_90 (ResourceModifier modifier)
-{
- switch (modifier)
- {
- case ROT0:
- return ROT90;
- case ROT90:
- return ROT180;
- case ROT180:
- return ROT270;
- case ROT270:
- return ROT0;
- case ROT0FLIP:
- return ROT270FLIP;
- case ROT90FLIP:
- return ROT0FLIP;
- case ROT180FLIP:
- return ROT90FLIP;
- case ROT270FLIP:
- return ROT180FLIP;
- default:
- assert (0);
- return ROT0;
- }
-}
-
-ResourceModifier rotate_270 (ResourceModifier modifier)
-{
- switch (modifier)
- {
- case ROT0:
- return ROT270;
- case ROT90:
- return ROT0;
- case ROT180:
- return ROT90;
- case ROT270:
- return ROT180;
- case ROT0FLIP:
- return ROT90FLIP;
- case ROT90FLIP:
- return ROT180FLIP;
- case ROT180FLIP:
- return ROT270FLIP;
- case ROT270FLIP:
- return ROT0FLIP;
- default:
- assert (0);
- return ROT0;
- }
-}
-
-std::string rs_to_string(ResourceModifier modifier)
-{
- switch (modifier)
- {
- case ROT0:
- return "ROT0";
- case ROT90:
- return "ROT90";
- case ROT180:
- return "ROT180";
- case ROT270:
- return "ROT270";
- case ROT0FLIP:
- return "ROT0FLIP";
- case ROT90FLIP:
- return "ROT90FLIP";
- case ROT180FLIP:
- return "ROT180FLIP";
- case ROT270FLIP:
- return "ROT270FLIP";
- default:
- assert (0);
- return "--Error--";
- }
-}
-
-ResourceModifier rs_from_string (const std::string& modifier)
-{
- if (modifier == "ROT0")
- return ROT0;
- else if (modifier == "ROT90")
- return ROT90;
- else if (modifier == "ROT180")
- return ROT180;
- else if (modifier == "ROT270")
- return ROT270;
- else if (modifier == "ROT0FLIP")
- return ROT0FLIP;
- else if (modifier == "ROT90FLIP")
- return ROT90FLIP;
- else if (modifier == "ROT180FLIP")
- return ROT180FLIP;
- else if (modifier == "ROT270FLIP")
- return ROT270FLIP;
- else
- {
- assert (0);
- return ROT0;
- }
-}
-
-} // namespace ResourceModifierNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/resource_modifier.hpp (from rev 2685,
branches/pingus_sdl/src/resource_modifier.hxx)
Deleted: branches/pingus_sdl/src/resource_modifier.hxx
===================================================================
--- branches/pingus_sdl/src/resource_modifier.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/resource_modifier.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,54 +0,0 @@
-// $Id: resource_modifier.hxx,v 1.6 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_RESOURCE_MODIFIER_HXX
-#define HEADER_PINGUS_RESOURCE_MODIFIER_HXX
-
-#include "pingus.hxx"
-#include <string>
-
-namespace ResourceModifierNS {
-
-/** This array contains possible modifications of a surface */
-typedef enum {
- ROT0,
- ROT90,
- ROT180,
- ROT270,
- ROT0FLIP,
- ROT90FLIP,
- ROT180FLIP,
- ROT270FLIP
-} ResourceModifier;
-
-ResourceModifier horizontal_flip (ResourceModifier);
-ResourceModifier vertical_flip (ResourceModifier);
-ResourceModifier rotate_90 (ResourceModifier);
-ResourceModifier rotate_270 (ResourceModifier);
-
-// we don't specialize the CL_String::to templates here, since the enum
-// might get confused with 'int'
-std::string rs_to_string (ResourceModifier);
-ResourceModifier rs_from_string (const std::string&);
-
-} // namespace ResourceModifierNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/result.hpp (from rev 2685,
branches/pingus_sdl/src/result.hxx)
Deleted: branches/pingus_sdl/src/result.hxx
===================================================================
--- branches/pingus_sdl/src/result.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/result.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,59 +0,0 @@
-// $Id: result.hxx,v 1.9 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_RESULT_HXX
-#define HEADER_PINGUS_RESULT_HXX
-
-#include "pingus_level.hxx"
-#include "pingus.hxx"
-
-
-/** Result of a Pingus game */
-struct Result
-{
- /** Leveldata */
- PingusLevel plf;
-
- /** Total number of that got saved */
- int saved;
-
- /** Total number of that got killed */
- int killed;
-
- /** Total number of Pingus */
- int total;
-
- /** Time used to finish this level */
- int used_time;
-
- /** Maximum time available for this level */
- int max_time;
-
- /** Number of Pingus needed to save */
- int needed;
-
- bool success() {
- return (saved >= needed);
- }
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/result_screen.cpp (from rev 2685,
branches/pingus_sdl/src/result_screen.cxx)
Deleted: branches/pingus_sdl/src/result_screen.cxx
===================================================================
--- branches/pingus_sdl/src/result_screen.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/result_screen.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,329 +0,0 @@
-// $Id: result_screen.cxx,v 1.20 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "gettext.h"
-#include "gui/display.hxx"
-#include "gui/surface_button.hxx"
-#include "gui/gui_manager.hxx"
-#include "gui/screen_manager.hxx"
-#include "blitter.hxx"
-#include "res_descriptor.hxx"
-#include "resource.hxx"
-#include "fonts.hxx"
-#include "game_session.hxx"
-#include "system.hxx"
-#include "sound/sound.hxx"
-#include "game_time.hxx"
-#include "result_screen.hxx"
-
-
-class ResultScreenComponent : public GUI::Component
-{
-public:
- Result result;
- Sprite background;
- std::string time_str;
-
- std::vector<Sprite> chalk_pingus;
-
- ResultScreenComponent(Result arg_result);
- virtual ~ResultScreenComponent() {}
- void draw(DrawingContext& gc) ;
-};
-
-class ResultScreenOkButton
- : public GUI::SurfaceButton
-{
-private:
- ResultScreen* parent;
-public:
- ResultScreenOkButton(ResultScreen* p)
- : GUI::SurfaceButton(Display::get_width()/2 + 225,
- Display::get_height()/2 + 125,
- ResDescriptor("core/start/ok"),
- ResDescriptor("core/start/ok_clicked"),
- ResDescriptor("core/start/ok_hover")),
- parent(p)
- {
- }
-
- void on_pointer_enter ()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound("tick");
- }
-
- void on_click() {
- parent->close_screen();
- Sound::PingusSound::play_sound("yipee");
- }
-};
-
-class ResultScreenAbortButton
- : public GUI::SurfaceButton
-{
-private:
- ResultScreen* parent;
-public:
- ResultScreenAbortButton(ResultScreen* p)
- : GUI::SurfaceButton(Display::get_width()/2 - 278,
- Display::get_height()/2 + 144,
- ResDescriptor("core/start/back"),
- ResDescriptor("core/start/back_clicked"),
- ResDescriptor("core/start/back_hover")),
- parent(p)
- {
- }
-
- void draw(DrawingContext& gc) {
- SurfaceButton::draw(gc);
- gc.print_center(Fonts::chalk_normal, (float)x_pos + 55, (float)y_pos,
_("Abort"));
- }
-
- void on_click() {
- parent->close_screen();
- }
-
-
- void on_pointer_enter()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
- }
-};
-
-class ResultScreenRetryButton
- : public GUI::SurfaceButton
-{
-private:
- ResultScreen* parent;
-public:
- ResultScreenRetryButton(ResultScreen* p)
- : GUI::SurfaceButton(Display::get_width()/2 + 225,
- Display::get_height()/2 + 125,
- ResDescriptor("core/start/ok"),
- ResDescriptor("core/start/ok_clicked"),
- ResDescriptor("core/start/ok_hover")),
- parent(p)
- {
- }
-
- void on_click()
- {
- parent->retry_level();
- }
-
- void on_pointer_enter()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
- }
-};
-
-ResultScreenComponent::ResultScreenComponent(Result arg_result)
- : result(arg_result)
-{
- if (Display::get_width() == 800 && Display::get_height() == 600)
- {
- background = Resource::load_sprite("core/menu/startscreenbg");
- }
-#if 0
- else
- {
- PixelBuffer pb =
Blitter::scale_surface_to_canvas(Resource::load_pixelbuffer(
-
"core/menu/startscreenbg"), Display::get_width(), Display::get_height());
- CL_SpriteDescription desc;
- desc.add_frame(pb);
- background = CL_Sprite(desc);
- }
- background.set_alignment(origin_center);
-#endif
-
- chalk_pingus.push_back(Resource::load_sprite("core/misc/chalk_pingu1"));
- chalk_pingus.push_back(Resource::load_sprite("core/misc/chalk_pingu2"));
- chalk_pingus.push_back(Resource::load_sprite("core/misc/chalk_pingu3"));
- chalk_pingus.push_back(Resource::load_sprite("core/misc/chalk_pingu4"));
-
- if (result.max_time == -1)
- time_str = "-";
- else
- time_str = GameTime::ticks_to_realtime_string(result.max_time -
result.used_time);
-}
-
-void
-ResultScreenComponent::draw(DrawingContext& gc)
-{
- gc.draw(background, Vector3f(gc.get_width()/2, gc.get_height()/2));
-
- if (!result.success())
- gc.print_right(Fonts::chalk_normal,
- (float)Display::get_width()/2 + 275,
- (float)Display::get_height()/2 + 110, _("Retry"));
-
- gc.print_center(Fonts::chalk_large, gc.get_width()/2,
- (float)Display::get_height()/2 - 200,
- _(result.plf.get_levelname()));
-
- if (result.success())
- {
- gc.print_center(Fonts::chalk_large, gc.get_width()/2,
- (float)Display::get_height()/2 - 140, _("Success!"));
- /*gc.print_center(Fonts::pingus_small, gc.get_width()/2,
gc.get_height()-30,
- "..:: Press Space to continue ::..");*/
- }
- else
- {
- gc.print_center(Fonts::chalk_large, gc.get_width()/2,
(float)Display::get_height()/2 - 140,
- _("Failure!"));
- /*gc.print_center(Fonts::pingus_normal, gc.get_width()/2,
gc.get_height()-30,
- "..:: Press Space to retry the level ::..");*/
- }
-
- std::string message;
- if (result.success())
- {
- if (result.killed == 0 && result.saved == result.total)
- message = _("Perfect! You saved everyone possible - great!");
- else if (result.killed == 0)
- message = _("No-one got killed, pretty good work.");
- else if (result.saved == result.needed)
- message = _("You saved exactly what you needed - you made it, but\n"
- "maybe you can do better?");
- else if (result.killed >= 5)
- message = _("Not everybody was saved, but still good work!");
- else
- message = _("What can I say, you made it - congratulations!");
- }
- else
- {
- if (result.killed == result.total)
- message = _("You killed everybody, not good.");
- else if (result.saved == 0)
- message = _("No-one got saved - I know you can do better.");
- else if (result.saved > 0)
- message = _("You didn't save enough, but you saved a few. Next\n"
- "time you might do better.");
- else if (result.saved + 1 >= result.needed)
- message = _("Only one more and you would have made it - try again!");
- else if (result.saved + 5 >= result.needed)
- message = _("Only a handful more and you would have made it - try
again!");
- else
- message = _("Better luck next time!");
- }
- gc.print_center(Fonts::chalk_normal, gc.get_width()/2,
- (float)Display::get_height()/2 - 70, message);
-
-
-#if 0
- for (int i = 0; i < result.saved; ++i)
- {
- gc.draw(chalk_pingus[rand() % chalk_pingus.size()], 230 + i * 15, 210);
- }
-#endif
-
-#if 0
- int left_x = Display::get_width()/2 - 100;
- int right_x = Display::get_width()/2 + 100;
- int y = Display::get_height()/2 + 10;
-
- gc.print_left(Fonts::chalk_normal, (float)left_x, (float)y, _("Saved: "));
- gc.print_right(Fonts::chalk_normal, (float)right_x, (float)y,
CL_String::to(result.saved)
- + "/" + CL_String::to(result.needed));;
-
- gc.print_left(Fonts::chalk_normal, (float)left_x, (float)(y+=30), _("Died:
"));
- gc.print_right(Fonts::chalk_normal, (float)right_x, (float)y,
CL_String::to(result.killed));
-
-
- gc.print_left(Fonts::chalk_normal, (float)left_x, (float)(y+=30), _("Time
left: "));
- gc.print_right(Fonts::chalk_normal, (float)right_x, (float)y, time_str);
-#endif
-}
-
-ResultScreen::ResultScreen(Result arg_result)
- : result(arg_result)
-{
- ResDescriptor ok_desc("core/result/ok");
- ResDescriptor cancel_desc("core/result/retry");
-
- ResultScreenComponent* comp = new ResultScreenComponent(result);
- gui_manager->add(comp, true);
-
- if (result.success())
- {
- gui_manager->add(new ResultScreenOkButton(this), true);
- }
- else
- {
- gui_manager->add(new ResultScreenAbortButton(this), true);
- gui_manager->add(new ResultScreenRetryButton(this), true);
- }
-
- //gui_manager->add(new GUI::SurfaceButton(500, 500, cancel_desc,
cancel_desc, cancel_desc), true);
-}
-
-void
-ResultScreen::on_startup()
-{
- if (result.success())
- {
- Sound::PingusSound::play_music("success_1.it");
- }
- else
- {
- Sound::PingusSound::play_music("pingus-2.it");
- }
-}
-
-void
-ResultScreen::retry_level()
-{
- ScreenManager::instance()->replace_screen(new PingusGameSession (result.plf,
true),
- true);
-}
-
-void
-ResultScreen::close_screen()
-{
- ScreenManager::instance()->pop_screen();
-}
-
-void
-ResultScreen::on_fast_forward_press()
-{
- on_pause_press();
-}
-
-void
-ResultScreen::on_pause_press()
-{
- if (result.success())
- close_screen();
- else
- retry_level();
-}
-
-void
-ResultScreen::on_escape_press()
-{
- close_screen();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/result_screen.hpp (from rev 2685,
branches/pingus_sdl/src/result_screen.hxx)
Deleted: branches/pingus_sdl/src/result_screen.hxx
===================================================================
--- branches/pingus_sdl/src/result_screen.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/result_screen.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,50 +0,0 @@
-// $Id: result_screen.hxx,v 1.5 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_RESULT_SCREEN_HXX
-#define HEADER_PINGUS_RESULT_SCREEN_HXX
-
-#include "result.hxx"
-#include "gui/gui_screen.hxx"
-
-
-/** */
-class ResultScreen : public GUIScreen
-{
-private:
- Result result;
-public:
- ResultScreen(Result result);
- void on_startup();
-
- void on_pause_press();
- void on_fast_forward_press();
- void on_escape_press();
-
- void retry_level();
- void close_screen();
-private:
- ResultScreen (const ResultScreen&);
- ResultScreen& operator= (const ResultScreen&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/savegame.cpp (from rev 2685,
branches/pingus_sdl/src/savegame.cxx)
Deleted: branches/pingus_sdl/src/savegame.cxx
===================================================================
--- branches/pingus_sdl/src/savegame.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/savegame.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,101 +0,0 @@
-// $Id: savegame.cxx,v 1.6 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-///#include "sexpr_file_writer.hxx"
-#include "savegame.hxx"
-
-
-std::string
-Savegame::status_to_string(S_Status status)
-{
- switch (status)
- {
- case FINISHED:
- return "finished";
-
- case ACCESSIBLE:
- return "accessible";
-
- case NONE:
- default:
- return "none";
- }
-}
-
-Savegame::S_Status
-Savegame::string_to_status (std::string str)
-{
-#if 0
- str = CL_String::to_lower(str);
- if (str == "accessible")
- return ACCESSIBLE;
- else if (str == "finished")
- return FINISHED;
- else if (str == "none")
- return NONE;
- else
-#endif
- return NONE;
-}
-
-Savegame::Savegame()
-{
- status = ACCESSIBLE;
- saved_pingus = 0;
- needed_time = 0;
-}
-
-Savegame::Savegame(FileReader reader)
-{
- read_xml(reader);
-}
-
-Savegame::Savegame(std::string arg_levelname, S_Status arg_status, int
arg_time, int arg_saved_pingus)
- : levelname(arg_levelname),
- status(arg_status),
- needed_time(arg_time),
- saved_pingus(arg_saved_pingus)
-{
-}
-
-#if 0
-void
-Savegame::write_xml(XMLFileWriter& writer)
-{
- writer.begin_section("level");
- writer.write_string ("name", levelname);
- writer.write_enum ("status", status, status_to_string);
- writer.write_int ("time", needed_time);
- writer.write_int ("saved-pingus", saved_pingus);
- writer.end_section();
-}
-#endif
-
-void
-Savegame::read_xml(FileReader reader)
-{
- reader.read_string ("name", levelname);
- reader.read_enum ("status", status, string_to_status);
- reader.read_int ("time", needed_time);
- reader.read_int ("saved-pingus", saved_pingus);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/savegame.hpp (from rev 2685,
branches/pingus_sdl/src/savegame.hxx)
Deleted: branches/pingus_sdl/src/savegame.hxx
===================================================================
--- branches/pingus_sdl/src/savegame.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/savegame.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,63 +0,0 @@
-// $Id: savegame.hxx,v 1.7 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SAVEGAME_HXX
-#define HEADER_PINGUS_SAVEGAME_HXX
-
-#include <string>
-#include "file_reader.hxx"
-
-
- class XMLFileWriter;
-
-/** The Savegame class holds savegame informations for a single
- level */
-class Savegame
-{
-private:
-public:
- enum S_Status { FINISHED, // level is successfully finished
- ACCESSIBLE, // level is accessible and can be played
- NONE }; // level is not finished and cannot be accessed
-
- static std::string status_to_string(S_Status s);
- static S_Status string_to_status (std::string s);
-
- std::string levelname;
- S_Status status;
-
- /** Time needed to finish the level, only valid if status == FINISHED */
- int needed_time;
-
- /** Number of Pingus that where saved while playing the level */
- int saved_pingus;
-
- Savegame();
- ~Savegame() { }
- Savegame(FileReader node);
- Savegame(std::string arg_levelname, S_Status arg_status, int arg_time, int
arg_saved_pingus);
-
- void read_xml(FileReader node);
- void write_xml(XMLFileWriter& xml);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/savegame_manager.cpp (from rev 2685,
branches/pingus_sdl/src/savegame_manager.cxx)
Deleted: branches/pingus_sdl/src/savegame_manager.cxx
===================================================================
--- branches/pingus_sdl/src/savegame_manager.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/savegame_manager.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,157 +0,0 @@
-// $Id: savegame_manager.cxx,v 1.9 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <fstream>
-#include <assert.h>
-#include "system.hxx"
-#include "pingus_error.hxx"
-////#include "xml_file_reader.hxx"
-///#include "xml_file_writer.hxx"
-#include "savegame_manager.hxx"
-
-
-SavegameManager* SavegameManager::instance_ = 0;
-
-SavegameManager*
-SavegameManager::instance()
-{
- if (instance_)
- return instance_;
- else
- return (instance_ = new SavegameManager(System::get_statdir() +
"savegames/savegames.xml"));
-}
-
-void SavegameManager::deinit()
-{
- delete instance_;
- instance_ = 0;
-}
-
-SavegameManager::SavegameManager(const std::string& arg_filename)
- : filename(arg_filename)
-{
-#if 0
- try
- {
- CL_DomDocument doc(new CL_InputSource_File(filename), true);
- CL_DomElement root = doc.get_document_element();
- if (root.get_tag_name() != "pingus-savegame")
- {
- PingusError::raise("Error: " + filename + ": not a <pingus-savegame>
file");
- }
- else
- {
- XMLFileReader reader(root);
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- {
- Savegame* savegame = new Savegame(*i);
- SavegameTable::iterator j = savegames.find(savegame->levelname);
-
- if (j != savegames.end())
- {
- std::cout << "SavegameManager: name collision: " <<
savegame->levelname << std::endl;
- delete j->second;
- j->second = savegame;
- }
- else
- {
- //std::cout << "SavegameManager: Loading savegame for: " <<
savegame->levelname << std::endl;
- savegames[savegame->levelname] = savegame;
- }
- }
- }
- }
- catch (...)
- {
- std::cout << "SavegameManager: Couldn't find savegame file '" << filename
- << "', starting with a empty one." << std::endl;
- }
-#endif
-}
-
-SavegameManager::~SavegameManager()
-{
- for (SavegameTable::iterator i = savegames.begin(); i != savegames.end ();
++i)
- delete i->second;
-}
-
-Savegame*
-SavegameManager::get(const std::string& levelname)
-{
- SavegameTable::iterator i = savegames.find(levelname);
- if (i == savegames.end())
- {
- return 0;
- }
- else
- {
- return i->second;
- }
-}
-
-void
-SavegameManager::store(Savegame& arg_savegame)
-{
- Savegame* savegame = new Savegame(arg_savegame);
- SavegameTable::iterator i = savegames.find(savegame->levelname);
- if (i == savegames.end())
- {
- savegames[savegame->levelname] = savegame;
- }
- else
- {
- if (i->second->status == Savegame::FINISHED
- && savegame->status == Savegame::ACCESSIBLE)
- { // saved game is better then new game
- delete savegame;
- }
- else
- { // new game is better or equal, save it
- delete i->second;
- i->second = savegame;
- }
- }
-
- flush();
-}
-
-void
-SavegameManager::flush()
-{
-#if 0
- std::ofstream out(filename.c_str());
- XMLFileWriter xml(out);
-
- xml.begin_section("pingus-savegame");
-
- for(SavegameTable::iterator i = savegames.begin(); i != savegames.end(); ++i)
- {
- assert(i->second);
- i->second->write_xml(xml);
- }
-
- xml.end_section(); // pingus-savegame
-#endif
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/savegame_manager.hpp (from rev 2685,
branches/pingus_sdl/src/savegame_manager.hxx)
Deleted: branches/pingus_sdl/src/savegame_manager.hxx
===================================================================
--- branches/pingus_sdl/src/savegame_manager.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/savegame_manager.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,55 +0,0 @@
-// $Id: savegame_manager.hxx,v 1.5 2003/10/18 12:11:30 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_SAVEGAME_MANAGER_HXX
-#define HEADER_SAVEGAME_MANAGER_HXX
-
-#include <map>
-#include "savegame.hxx"
-
-
-/** */
-class SavegameManager
-{
-private:
- static SavegameManager* instance_;
- typedef std::map<std::string, Savegame*> SavegameTable;
-
- std::string filename;
- SavegameTable savegames;
-public:
- static SavegameManager* instance();
- static void deinit();
- SavegameManager(const std::string& filename);
- ~SavegameManager();
-
- Savegame* get(const std::string& levelname);
- void store(Savegame&);
-
- /** Write the current savegames down to file */
- void flush();
-private:
- SavegameManager (const SavegameManager&);
- SavegameManager& operator= (const SavegameManager&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/screenshot.cpp (from rev 2685,
branches/pingus_sdl/src/screenshot.cxx)
Deleted: branches/pingus_sdl/src/screenshot.cxx
===================================================================
--- branches/pingus_sdl/src/screenshot.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/screenshot.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,199 +0,0 @@
-// $Id: screenshot.cxx,v 1.17 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <config.h>
-#include <time.h>
-#include <stdio.h>
-#include <fstream>
-#include <iostream>
-
-#include <ClanLib/Display/pixel_format.h>
-#include <ClanLib/Display/pixel_buffer.h>
-#include <ClanLib/Display/display.h>
-#include <ClanLib/Display/Providers/provider_factory.h>
-#include "system.hxx"
-#include "screenshot.hxx"
-#include "gettext.h"
-
-
-// Saves a screenshot to file, it return the filename the screenshot
-// was saved to.
-std::string
-Screenshot::make_screenshot()
-{
- std::string filename = get_filename();
- std::cout << _("Screenshot: Saving screenshot to: ") << filename <<
std::endl;
- CL_ProviderFactory::save(CL_Display::get_front_buffer(), filename);
- std::cout << _("Screenshot: Screenshot is done.") << std::endl;
-
- return filename;
-}
-
-void
-Screenshot::save_target_to_file(PixelBuffer target, const std::string&
filename)
-{
- save_target_to_file_fast(target, filename);
-}
-
-void
-Screenshot::save_target_to_file_fast(PixelBuffer target, const std::string&
filename)
-{
- target.lock();
- int num_pixels = target.get_width() * target.get_height();
- unsigned char* buffer = new unsigned char[num_pixels * 3];
- unsigned char* target_buffer = reinterpret_cast<unsigned
char*>(target.get_data());
-
- unsigned int rmask = target.get_format().get_red_mask();
- unsigned int gmask = target.get_format().get_green_mask();
- unsigned int bmask = target.get_format().get_blue_mask();
-
- switch(target.get_format().get_depth())
- {
- case 16: // 16bit
- {
- for (int i = 0; i < num_pixels; ++i)
- {
- unsigned int color = *((unsigned short*)(target_buffer + i*2));
-
- buffer[i*3 + 0] = (color & rmask) * 255 / rmask;
- buffer[i*3 + 1] = (color & gmask) * 255 / gmask;
- buffer[i*3 + 2] = (color & bmask) * 255 / bmask;
- }
- break;
- }
- case 24: // 24bit
- {
- // that should do the trick - untested !!!
- for (int i = 0; i < num_pixels; ++i)
- {
- unsigned char* d = target_buffer + i*3;
-#ifdef WORDS_BIGENDIAN
- unsigned int color = (*d << 16) | (*(d+1) << 8) | (*(d+2));
-#else
- unsigned int color = (*d) | (*(d+1) << 8) | (*(d+2) << 16);
-#endif
-
- buffer[i*3 + 0] = (color & rmask) * 255 / rmask;
- buffer[i*3 + 1] = (color & gmask) * 255 / gmask;
- buffer[i*3 + 2] = (color & bmask) * 255 / bmask;
- }
- break;
- }
- case 32: // 32bit
- {
- for (int i = 0; i < num_pixels; ++i)
- {
- buffer[i*3 + 0] = target_buffer[i*4 + 3];
- buffer[i*3 + 1] = target_buffer[i*4 + 2];
- buffer[i*3 + 2] = target_buffer[i*4 + 1];
- }
- break;
- }
-
- }
-
- target.unlock();
- save_ppm(filename, buffer, target.get_width(), target.get_height());
- delete[] buffer;
-}
-
-void
-Screenshot::save_ppm(const std::string& filename, unsigned char* buffer, int
width, int height)
-{
- FILE* out = fopen(filename.c_str(), "wb");
-
- if (!out)
- {
- perror(filename.c_str());
- std::cout << _("Screenshot: Couldn't write file: ") << filename <<
std::endl;
- return;
- }
-
- fprintf(out,
- "P6\n"
- "# CREATOR: Pingus %s\n"
- "%d %d\n"
- "255\n",
- VERSION,
- width,
- height);
-
- fwrite(buffer, sizeof(unsigned char), width * height * 3, out);
- fclose(out);
-}
-
-void
-Screenshot::save_target_to_file_slow(PixelBuffer target, const std::string&
filename)
-{
- std::ofstream out(filename.c_str());
-
- out << "P3\n"
- << "# CREATOR: Pingus... some version\n"
- << target.get_width() << " "
- << target.get_height() << "\n"
- << "255" << std::endl;
-
- target.lock();
-
- for (int y=0; y < target.get_height(); ++y)
- {
- for (int x=0; x < target.get_width(); ++x)
- {
- Color color = target.get_pixel(x, y);
- out << (int)(color.get_red()) << " "
- << (int)(color.get_green()) << " "
- << (int)(color.get_blue()) << "\n";
- }
- }
-
- target.unlock();
-}
-
-std::string
-Screenshot::get_filename()
-{
- std::string tmp_filename;
- char str [16];
- int i = 1;
-
- do {
- snprintf(str, 16, "%d.png", i);
- tmp_filename = System::get_statdir() + "screenshots/"
- + "pingus-" + get_date() + "-" + std::string(str);
- ++i;
- } while (System::exist(tmp_filename));
-
- return tmp_filename;
-}
-
-std::string
-Screenshot::get_date()
-{
- char buffer[64];
- time_t curtime;
- struct tm *loctime;
- curtime = time (NULL);
- loctime = localtime(&curtime);
- strftime(buffer, 64, "%Y%m%d-%H%M%S", loctime);
-
- return std::string(buffer);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/screenshot.hpp (from rev 2685,
branches/pingus_sdl/src/screenshot.hxx)
Deleted: branches/pingus_sdl/src/screenshot.hxx
===================================================================
--- branches/pingus_sdl/src/screenshot.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/screenshot.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,53 +0,0 @@
-// $Id: screenshot.hxx,v 1.8 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SCREENSHOT_HXX
-#define HEADER_PINGUS_SCREENSHOT_HXX
-
-#include "pingus.hxx"
-#include <ClanLib/Display/pixel_buffer.h>
-#include <string>
-
-class CL_Target;
-
-
-/** Simple class to get a screenshot and save it as pnm */
-class Screenshot
-{
-private:
- static std::string get_date();
- static std::string get_filename();
- static void save_target_to_file_fast(PixelBuffer , const std::string&
filename);
- static void save_target_to_file_slow(PixelBuffer , const std::string&
filename);
-public:
- static std::string make_screenshot();
- static void save_target_to_file(PixelBuffer , const std::string& filename);
-
- /** buffer must be RGB and width*height*3 large */
- static void save_ppm(const std::string& filename, unsigned char* buffer, int
width, int height);
-private:
- Screenshot ();
- Screenshot (const Screenshot&);
- Screenshot& operator= (const Screenshot&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/server.cpp (from rev 2685,
branches/pingus_sdl/src/server.cxx)
Deleted: branches/pingus_sdl/src/server.cxx
===================================================================
--- branches/pingus_sdl/src/server.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/server.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,108 +0,0 @@
-// $Id: server.cxx,v 1.29 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "pingu.hxx"
-#include "globals.hxx"
-#include "server.hxx"
-#include "game_time.hxx"
-#include "world.hxx"
-#include "demo_recorder.hxx"
-#include "goal_manager.hxx"
-
-
-using Actions::action_from_string;
-
-Server::Server(const PingusLevel& arg_plf)
- : plf(arg_plf),
- world(new World (plf)),
- action_holder (plf),
- goal_manager(new GoalManager(this)),
- demo_recorder(0)
-{
- if (enable_demo_recording)
- demo_recorder = new DemoRecorder(this);
-}
-
-Server::~Server ()
-{
- // Demo Server is exited and writes down its log
- delete goal_manager;
- delete demo_recorder;
- delete world;
-}
-
-World*
-Server::get_world()
-{
- return world;
-}
-
-void
-Server::update()
-{
- world->update();
- goal_manager->update();
-}
-
-void
-Server::send_armageddon_event ()
-{
- world->armageddon();
-
- if (demo_recorder)
-
demo_recorder->record_event(ServerEvent::make_armageddon_event(get_time()));
-}
-
-void
-Server::send_pingu_action_event (Pingu* pingu, Actions::ActionName action)
-{
- if (action_holder.pop_action(action))
- {
- if (!(pingu->request_set_action(action)))
- {
- action_holder.push_action(action);
- }
- }
-
- if (demo_recorder)
-
demo_recorder->record_event(ServerEvent::make_pingu_action_event(get_time(),
-
pingu->get_id(),
- action));
-}
-
-bool
-Server::is_finished ()
-{
- return goal_manager->is_finished();
-}
-
-ActionHolder*
-Server::get_action_holder ()
-{
- return &action_holder;
-}
-
-int
-Server::get_time ()
-{
- return get_world()->get_game_time()->get_ticks();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/server.hpp (from rev 2685,
branches/pingus_sdl/src/server.hxx)
Deleted: branches/pingus_sdl/src/server.hxx
===================================================================
--- branches/pingus_sdl/src/server.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/server.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,80 +0,0 @@
-// $Id: server.hxx,v 1.16 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SERVER_HXX
-#define HEADER_PINGUS_SERVER_HXX
-
-#include "server_event.hxx"
-#include "action_holder.hxx"
-#include "pingus_level.hxx"
-
-
-class Pingu;
-class World;
-class DemoRecorder;
-class GoalManager;
-
-/** A abstract server-like class */
-class Server
-{
-protected:
- PingusLevel plf;
- World* world;
-
- /** Manager class for the number of available actions */
- ActionHolder action_holder;
-
- GoalManager* goal_manager;
-
- DemoRecorder* demo_recorder;
-
-public:
- Server(const PingusLevel& arg_plf);
- virtual ~Server();
-
- virtual void update();
-
- PingusLevel get_plf () { return plf; }
-
- int get_time();
-
- World* get_world();
- ActionHolder* get_action_holder();
-
- /** @return true if the server is finished and the game can be
- exited */
- bool is_finished();
-
- /** set the server into the finshed state, this is used when you
- press ESCAPE inside a game */
- virtual void set_finished() =0;
-
- /* Event handling stuff */
- void send_armageddon_event();
- void send_pingu_action_event(Pingu* pingu, Actions::ActionName action);
-
-private:
- Server (const Server&);
- Server& operator= (const Server&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/server_event.cpp (from rev 2685,
branches/pingus_sdl/src/server_event.cxx)
Deleted: branches/pingus_sdl/src/server_event.cxx
===================================================================
--- branches/pingus_sdl/src/server_event.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/server_event.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,124 +0,0 @@
-// $Id: server_event.cxx,v 1.9 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include <iostream>
-#include "pingus_error.hxx"
-#include "server.hxx"
-#include "world.hxx"
-#include "pingu_holder.hxx"
-
-
-ServerEvent::ServerEvent() :
- type(PINGU_ACTION_EVENT),
- time_stamp(0),
- pingu_id(0),
- pingu_action(Actions::Walker)
-{
-}
-
-ServerEvent::ServerEvent(FileReader reader)
-{
- if (reader.get_name() == "armageddon")
- {
- type = ARMAGEDDON_EVENT;
- reader.read_int("time", time_stamp);
- }
- else if (reader.get_name() == "pingu-action")
- {
- type = PINGU_ACTION_EVENT;
- reader.read_int ("time", time_stamp);
- reader.read_int ("id", pingu_id);
- reader.read_enum("action", pingu_action, Actions::action_from_string);
- }
- else
- {
- PingusError::raise(std::string("ServerEvent: Parse error: Unknown event:
")
- + reader.get_name());
- }
-}
-
-void
-ServerEvent::write_xml(std::ostream& xml) const
-{
-#if 0
- switch(type)
- {
- case ARMAGEDDON_EVENT:
- xml << " <armageddon time=\"" << CL_String::to(time_stamp) << "\"/>" <<
std::endl;
- break;
- case PINGU_ACTION_EVENT:
- xml << " <pingu-action time=\"" << CL_String::to(time_stamp) << "\"
id=\"" << pingu_id
- << "\" action=\"" << Actions::action_to_string(pingu_action) <<
"\"/>" << std::endl;
- break;
- default:
- assert(!"Unknown type");
- }
-#endif
-}
-
-ServerEvent
-ServerEvent::make_armageddon_event(int t)
-{
- ServerEvent event;
- event.type = ARMAGEDDON_EVENT;
- event.time_stamp = t;
- return event;
-}
-
-ServerEvent
-ServerEvent::make_pingu_action_event(int t, int id, Actions::ActionName action)
-{
- ServerEvent event;
- event.type = PINGU_ACTION_EVENT;
- event.time_stamp = t;
- event.pingu_id = id;
- event.pingu_action = action;
- return event;
-}
-
-void
-ServerEvent::send(Server* server)
-{
- switch(type)
- {
- case ARMAGEDDON_EVENT:
- server->send_armageddon_event();
- break;
- case PINGU_ACTION_EVENT:
- {
- Pingu* pingu = server->get_world()->get_pingus()->get_pingu(pingu_id);
- if (pingu)
- {
- server->send_pingu_action_event(pingu,
- pingu_action);
- }
- else
- {
- std::cout << "ServerEvent: DemoFile inconsistent with world" <<
std::endl;
- }
- }
- break;
- default:
- assert(!"Unknown type");
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/server_event.hpp (from rev 2685,
branches/pingus_sdl/src/server_event.hxx)
Deleted: branches/pingus_sdl/src/server_event.hxx
===================================================================
--- branches/pingus_sdl/src/server_event.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/server_event.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,72 +0,0 @@
-// $Id: server_event.hxx,v 1.5 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SERVER_EVENT_HXX
-#define HEADER_PINGUS_SERVER_EVENT_HXX
-
-#include <iosfwd>
-#include "file_reader.hxx"
-#include "pingu_enums.hxx"
-
-
-class Server;
-
-/** This class represents an event that the Server can recieve from
- the client. Only actions and armageddon are here, the rest happens
- Client internal and the server knows nothing about it (scrolling,
- pause, fastforward, etc.) FIXME: this is only half true... */
-class ServerEvent
-{
-public:
- enum Type { ARMAGEDDON_EVENT,
- PINGU_ACTION_EVENT };
-
- /** The type of event */
- Type type;
-
- /** the time at which the event should take place */
- int time_stamp;
-
- // stuff for pingu_action_event
-
- /** Id of the pingu which should get the actions */
- int pingu_id;
-
- /** action name */
- Actions::ActionName pingu_action;
-
- ServerEvent();
-
- /** Construct an server event from an xml subtree */
- ServerEvent(FileReader reader);
-
- void write_xml(std::ostream& xml) const;
-
- /** Send this event to the server */
- void send(Server*);
-
- // Pseudo constructors
- static ServerEvent make_armageddon_event(int time);
- static ServerEvent make_pingu_action_event(int t, int id,
Actions::ActionName action);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/sexpr_pingus_level.cpp (from rev 2685,
branches/pingus_sdl/src/sexpr_pingus_level.cxx)
Deleted: branches/pingus_sdl/src/sexpr_pingus_level.cxx
===================================================================
--- branches/pingus_sdl/src/sexpr_pingus_level.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/sexpr_pingus_level.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,36 +0,0 @@
-/* $Id$
-** __ __ __ ___ __ __ __ __
-** / \ / \__| ____ __| _/_______/ |_|__| | | | ____
-** \ \/\/ / |/ \ / __ |/ ___/\ __\ | | | | _/ __ \
-** \ /| | | \/ /_/ |\___ \ | | | | |_| |_\ ___/
-** \__/\ / |__|___| /\____ /____ > |__| |__|____/____/\___ >
-** \/ \/ \/ \/ \/
-** Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-**
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of the GNU General Public License
-** as published by the Free Software Foundation; either version 2
-** of the License, or (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-** 02111-1307, USA.
-*/
-
-#include "sexpr_pingus_level.hpp"
-
-SExrPingusLevel::SExrPingusLevel(const std::string& res_name,
- const std::string& filename)
-{
- impl->resname = res_name;
-
-
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/sexpr_pingus_level.hpp (from rev 2685,
branches/pingus_sdl/src/sexpr_pingus_level.hxx)
Deleted: branches/pingus_sdl/src/sexpr_pingus_level.hxx
===================================================================
--- branches/pingus_sdl/src/sexpr_pingus_level.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/sexpr_pingus_level.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,37 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_SEXPR_PINGUS_LEVEL_HXX
-#define HEADER_SEXPR_PINGUS_LEVEL_HXX
-
-#include "pingus_level.hxx"
-
-/** */
-class SExprPingusLevel : public PingusLevel
-{
-private:
-public:
- SExrPingusLevel(const std::string& res_name,
- const std::string& filename);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/shared_ptr.hpp (from rev 2685,
branches/pingus_sdl/src/shared_ptr.hxx)
Deleted: branches/pingus_sdl/src/shared_ptr.hxx
===================================================================
--- branches/pingus_sdl/src/shared_ptr.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/shared_ptr.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,51 +0,0 @@
-// $Id$
-//
-// Flexlay - A Generic 2D Game Editor
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_SHARED_PTR_HXX
-#define HEADER_SHARED_PTR_HXX
-
-#include <assert.h>
-
-/** */
-template<typename T>
-class SharedPtr
-{
-private:
- T* ptr;
-public:
- template<typename Parent> friend class SharedPtr;
-
- SharedPtr() : ptr(0) {}
- SharedPtr(T* p) : ptr(p) {}
-
- template <typename Parent>
- SharedPtr(const SharedPtr<Parent>& p) : ptr(p.ptr) {}
-
- T& operator*() { assert(ptr); return *ptr; }
- T const& operator*() const { assert(ptr); return *ptr; }
-
- T* operator->() { assert(ptr); return ptr; }
- T const* operator->() const { assert(ptr); return ptr; }
-
- T* get() const { return ptr; }
-};
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/smallmap_image.cpp (from rev 2685,
branches/pingus_sdl/src/smallmap_image.cxx)
Deleted: branches/pingus_sdl/src/smallmap_image.cxx
===================================================================
--- branches/pingus_sdl/src/smallmap_image.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/smallmap_image.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,222 +0,0 @@
-// $Id: smallmap_image.cxx,v 1.13 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "world.hxx"
-#include "smallmap_image.hxx"
-#include "col_map.hxx"
-#include "server.hxx"
-
-
-SmallMapImage::SmallMapImage(Server* s, int width, int height)
- : server(s),
- ////canvas(width, height, width*4, CL_PixelFormat::rgba8888),
- update_count(0),
- colmap_serial(0)
-{
- update_surface();
-}
-
-void
-SmallMapImage::update (float delta)
-{
- float smallmap_update_time = 1.0f;
-
- update_count += delta;
-
- if (update_count > smallmap_update_time)
- {
- update_count = 0.0f;
- ColMap* colmap = server->get_world()->get_colmap();
-
- if (colmap_serial != colmap->get_serial())
- {
- update_surface();
- }
- }
-}
-
-Sprite
-SmallMapImage::get_surface ()
-{
- if (sur)
- {
- return sur;
- }
- else
- {
- update_surface();
- return sur;
- }
-}
-
-void
-SmallMapImage::update_surface()
-{
-#if 0
- unsigned char* buffer;
- unsigned char* cbuffer;
- unsigned char current_pixel;
-
- ColMap* colmap = server->get_world()->get_colmap();
- buffer = colmap->get_data();
-
- colmap_serial = colmap->get_serial();
-
- canvas.lock();
-
- cbuffer = static_cast<unsigned char*>(canvas.get_data());
-
- int alpha = 255;
-
- int cmap_width = colmap->get_width();
- int cmap_height = colmap->get_height();
-
- int width = canvas.get_width();
- int height = canvas.get_height();
- for(int y = 0; y < height; ++y)
- {
- for (int x = 0; x < width; ++x)
- {
- // Index on the smallmap canvas
- int i = 4 * ((y * width) + x);
-
- int tx = x * cmap_width / width;
- int ty = y * cmap_height / height;
-
- current_pixel = buffer[tx + (ty * cmap_width)];
-
- switch (current_pixel)
- {
- case Groundtype::GP_NOTHING:
- if (!CL_Endian::is_system_big())
- {
- cbuffer[i + 0] = alpha;
- cbuffer[i + 1] = 0;
- cbuffer[i + 2] = 0;
- cbuffer[i + 3] = 0;
- }
- else
- {
- cbuffer[i + 3] = alpha;
- cbuffer[i + 2] = 0;
- cbuffer[i + 1] = 0;
- cbuffer[i + 0] = 0;
- }
- break;
-
- case Groundtype::GP_BRIDGE:
- if (!CL_Endian::is_system_big())
- {
- cbuffer[i + 0] = 255;
- cbuffer[i + 1] = 100;
- cbuffer[i + 2] = 255;
- cbuffer[i + 3] = 0;
- }
- else
- {
- cbuffer[i + 3] = 255;
- cbuffer[i + 2] = 100;
- cbuffer[i + 1] = 255;
- cbuffer[i + 0] = 0;
- }
- break;
-
- case Groundtype::GP_WATER:
- case Groundtype::GP_LAVA:
- if (!CL_Endian::is_system_big())
- {
- cbuffer[i + 0] = 255;
- cbuffer[i + 1] = 200;
- cbuffer[i + 2] = 0;
- cbuffer[i + 3] = 0;
- }
- else
- {
- cbuffer[i + 3] = 255;
- cbuffer[i + 2] = 200;
- cbuffer[i + 1] = 0;
- cbuffer[i + 0] = 0;
- }
- break;
-
-#if 0
- // FIXME: temporaty disabled for 0.6.0 release, since all
liquids are currently lava
- case Groundtype::GP_LAVA:
- if (!CL_Endian::is_system_big())
- {
- cbuffer[i + 0] = 255; // alpha
- cbuffer[i + 1] = 255; // blue
- cbuffer[i + 2] = 128; // green
- cbuffer[i + 3] = 128; // red
- }
- else
- {
- cbuffer[i + 3] = 255; // alpha
- cbuffer[i + 2] = 255; // blue
- cbuffer[i + 1] = 128; // green
- cbuffer[i + 0] = 128; // red
- }
- break;
-#endif
-
- case Groundtype::GP_SOLID:
- if (!CL_Endian::is_system_big())
- {
- cbuffer[i + 0] = 255;
- cbuffer[i + 1] = 100;
- cbuffer[i + 2] = 100;
- cbuffer[i + 3] = 100;
- }
- else
- {
- cbuffer[i + 3] = 255;
- cbuffer[i + 2] = 100;
- cbuffer[i + 1] = 100;
- cbuffer[i + 0] = 100;
- }
- break;
-
- default:
- if (!CL_Endian::is_system_big())
- {
- cbuffer[i + 0] = 255;
- cbuffer[i + 1] = 200;
- cbuffer[i + 2] = 200;
- cbuffer[i + 3] = 200;
- }
- else
- {
- cbuffer[i + 3] = 255;
- cbuffer[i + 2] = 200;
- cbuffer[i + 1] = 200;
- cbuffer[i + 0] = 200;
- }
- break;
- }
- }
- }
- canvas.unlock();
- CL_SpriteDescription desc;
- desc.add_frame(canvas);
- sur = CL_Sprite(desc);
-#endif
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/smallmap_image.hpp (from rev 2685,
branches/pingus_sdl/src/smallmap_image.hxx)
Deleted: branches/pingus_sdl/src/smallmap_image.hxx
===================================================================
--- branches/pingus_sdl/src/smallmap_image.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/smallmap_image.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,63 +0,0 @@
-// $Id: smallmap_image.hxx,v 1.11 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SMALLMAP_IMAGE_HXX
-#define HEADER_PINGUS_SMALLMAP_IMAGE_HXX
-
-#include "pingus.hxx"
-#include "sprite.hpp"
-
-class Server;
-
-/** The base image of the small map, it doesn't handle any userinput,
- it only generates the surface */
-class SmallMapImage
-{
-private:
- Server* server;
-
- /** The canvas that represents the small-colmap */
- ////PixelBuffer canvas;
-
- /** Graphic surface for the generated rectanglar background of the small map
*/
- Sprite sur;
-
- /** number of seconds till the smallmap will update itself */
- float update_count;
-
- /** The serial is used to track changes to the colmap */
- unsigned int colmap_serial;
-
-public:
- SmallMapImage (Server* s, int width, int height);
- void update (float delta);
-
- Sprite get_surface();
-
- /** Regenerate the smallmap surface */
- void update_surface();
-private:
- SmallMapImage (const SmallMapImage&);
- SmallMapImage& operator= (const SmallMapImage&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/sound/slot_manager.cpp (from rev 2685,
branches/pingus_sdl/src/sound/slot_manager.cxx)
Deleted: branches/pingus_sdl/src/sound/slot_manager.cxx
===================================================================
--- branches/pingus_sdl/src/sound/slot_manager.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/sound/slot_manager.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,53 +0,0 @@
-// $Id: slot_manager.cxx,v 1.3 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "slot_manager.hxx"
-
-namespace Sound {
-
-SlotEntry&
-SlotManager::find_slot(const std::string& name)
-{
-
-}
-
-void
-SlotManager::play_sound(const std::string& name)
-{
- CL_SoundBuffer * buffer;
- CL_SoundBuffer_Session sess;
-
- try {
- buffer = new CL_SoundBuffer (name.c_str());
- sess = buffer -> prepare();
- } catch (const CL_Error & e) {
- perr(PINGUS_DEBUG_SOUND) << "Can't open file " << filename << " --
skipping\n"
- << " CL_Error: " << e.message << std::endl;
- return;
- }
-
- sess.set_volume(volume);
- sess.set_pan(panning);
- sess.set_looping(false);
- sess.play();
-}
-
-} // namespace Sound
-
-/* EOF */
Copied: branches/pingus_sdl/src/sound/slot_manager.hpp (from rev 2685,
branches/pingus_sdl/src/sound/slot_manager.hxx)
Deleted: branches/pingus_sdl/src/sound/slot_manager.hxx
===================================================================
--- branches/pingus_sdl/src/sound/slot_manager.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/sound/slot_manager.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,70 +0,0 @@
-// $Id: slot_manager.hxx,v 1.3 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SLOT_MANAGER_HXX
-#define HEADER_PINGUS_SLOT_MANAGER_HXX
-
-#include <string>
-#include <vector>
-#include <map>
-
-#include <ClanLib/sound.h>
-
-namespace Sound {
-
-struct SlotEntry
-{
- /** Name of the sound effect */
- std::string name;
-
- /** Time when the last sound playback started */
- unsigned int last_time;
-
- /** The data of this sound effect */
- CL_SoundBuffer* buffer;
-
- /** Currently active sessinos playing the sound effect */
- std::vector<CL_SoundBuffer_Session> sessions;
-};
-
-/** Manager class for sound slots, if a sound effect gets played it
- will be placed in a slot, if the same effect gets played again and
- the slot is still busy it won't get played again */
-class SlotManager
-{
-private:
- std::map<std::string, SlotEntry> slots;
-
-public:
- SlotManager();
-
- void play_sound(const std::string& name);
-
-private:
- SlotEntry& find_slot(const std::string& name);
-
- SlotManager (const SlotManager&);
- SlotManager& operator= (const SlotManager&);
-};
-
-} // namespace Sound
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/sound/sound.cpp (from rev 2685,
branches/pingus_sdl/src/sound/sound.cxx)
Deleted: branches/pingus_sdl/src/sound/sound.cxx
===================================================================
--- branches/pingus_sdl/src/sound/sound.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/sound/sound.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,130 +0,0 @@
-// $Id: sound.cxx,v 1.7 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <assert.h>
-#include "../path_manager.hxx"
-#include "../globals.hxx"
-#include "sound_dummy.hxx"
-#include "sound.hxx"
-
-namespace Sound {
-
-PingusSoundImpl * PingusSound::sound;
-
-void
-PingusSound::init (PingusSoundImpl* s)
-{
- if (s == 0)
- {
- PingusSound::init(new PingusSoundDummy());
-#if 0
- if (sound_enabled || music_enabled)
- {
- if (verbose)
- std::cout << "Init Sound" << std::endl;
-
- try {
- PingusSound::init (new PingusSoundReal ());
- } catch (CL_Error& err) {
- std::cout << "CL_Error: " << err.message << std::endl;
- std::cout << "Sound will be disabled" << std::endl;
- PingusSound::init (new PingusSoundDummy ());
- }
- }
- else
- {
- if (verbose)
- std::cout << "Sound disabled" << std::endl;
- PingusSound::init (new PingusSoundDummy ());
- }
-#endif
- }
- else
- {
- sound = s;
- }
-}
-
-void
-PingusSound::deinit ()
-{
- delete sound;
- sound = 0;
-}
-
-/** Load a sound file and play it immediately.
- @param filename The complete filename
- @param volume The desired volume level
- @param panning The desired panning level (stereo only) */
-void
-PingusSound::play_sound(const std::string& name, float volume, float panning)
-{
- assert(sound);
- sound->real_play_sound(name, volume, panning);
-}
-
-void
-PingusSound::play_sound(Sound::Name name, float volume, float panning)
-{
- // FIXME: We need to return a handle to the sound
-
- // This should be configurable via a .xml file
- switch (name)
- {
- case Sound::DIGGER:
- play_sound (path_manager.complete ("sounds/digger.wav"), volume,
panning);
- break;
- case Sound::PLOP:
- play_sound (path_manager.complete ("sounds/plop.wav"), volume, panning);
- break;
- case Sound::GOODIDEA:
- play_sound (path_manager.complete ("sounds/goodidea.wav"), volume,
panning);
- break;
- case Sound::OHNO:
- play_sound (path_manager.complete ("sounds/ohno.wav"), volume, panning);
- break;
- case Sound::TICK:
- play_sound (path_manager.complete ("sounds/tick.wav"), volume, panning);
- break;
- }
-}
-
-/** Load a sound file and play it immediately.
-
address@hidden name
address@hidden volume volume */
-void
-PingusSound::play_music(const std::string & name, float volume)
-{
- assert (sound);
- sound->real_play_music(path_manager.complete ("music/" + name), volume);
-}
-
-void
-PingusSound::stop_music()
-{
- assert(sound);
- sound->real_stop_music();
-}
-
-} // namespace Sound
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/sound/sound.hpp (from rev 2685,
branches/pingus_sdl/src/sound/sound.hxx)
Deleted: branches/pingus_sdl/src/sound/sound.hxx
===================================================================
--- branches/pingus_sdl/src/sound/sound.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/sound/sound.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,64 +0,0 @@
-// $Id: sound.hxx,v 1.4 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SOUND_HXX
-#define HEADER_PINGUS_SOUND_HXX
-
-#include <string>
-#include "sounds.hxx"
-#include "sound_impl.hxx"
-
-namespace Sound {
-
-class PingusSoundImpl;
-
-class PingusSound
-{
-private:
- static PingusSoundImpl* sound;
-
-public:
- PingusSound () { }
- ~PingusSound () { }
-
- static void init (PingusSoundImpl* s = 0);
- static void deinit ();
-
- /** Load a sound file and play it immediately.
-
- @param name Name of the sound, aka 'ohno'
- @param volume volume
- @param panning panning */
- static void play_sound(const std::string & name, float volume = 1.0f, float
panning = 0.0f);
-
- static void play_music(const std::string & name, float volume = 1.0f);
- static void stop_music();
-
- static void play_sound(Sound::Name name, float volume = 1.0f, float panning
= 0.0f);
-
-private:
- PingusSound (const PingusSound&);
- PingusSound& operator= (const PingusSound&);
-};
-
-} // namespace Sound
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/sound/sound_dummy.cpp (from rev 2685,
branches/pingus_sdl/src/sound/sound_dummy.cxx)
Deleted: branches/pingus_sdl/src/sound/sound_dummy.cxx
===================================================================
--- branches/pingus_sdl/src/sound/sound_dummy.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/sound/sound_dummy.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,47 +0,0 @@
-// $Id: sound_dummy.cxx,v 1.3 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../globals.hxx"
-#include "../debug.hxx"
-#include "sound_dummy.hxx"
-
-namespace Sound {
-
-void
-PingusSoundDummy::real_play_sound(const std::string & filename, float
/*volume*/, float /*panning*/)
-{
- pout(PINGUS_DEBUG_SOUND) << "PingusSoundDummy::real_play_sound: " <<
filename << std::endl;
-}
-
-
-void
-PingusSoundDummy::real_play_music(const std::string & filename, float
/*volume*/)
-{
- pout(PINGUS_DEBUG_SOUND) << "PingusSoundDummy::real_play_music: " <<
filename << std::endl;
-}
-
-void
-PingusSoundDummy::real_stop_music()
-{
-}
-
-} // namespace Sound
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/sound/sound_dummy.hpp (from rev 2685,
branches/pingus_sdl/src/sound/sound_dummy.hxx)
Deleted: branches/pingus_sdl/src/sound/sound_dummy.hxx
===================================================================
--- branches/pingus_sdl/src/sound/sound_dummy.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/sound/sound_dummy.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,46 +0,0 @@
-// $Id: sound_dummy.hxx,v 1.3 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SOUND_DUMMY_HXX
-#define HEADER_PINGUS_SOUND_DUMMY_HXX
-
-#include "sound_impl.hxx"
-#include "sound.hxx"
-
-namespace Sound {
-
-class PingusSoundDummy : public PingusSoundImpl
-{
-public:
- PingusSoundDummy () { }
- virtual ~PingusSoundDummy () { }
-
- virtual void real_play_sound (const std::string & filename, float volume,
float panning);
- virtual void real_play_music (const std::string & filename, float volume);
- virtual void real_stop_music();
-private:
- PingusSoundDummy (const PingusSoundDummy&);
- PingusSoundDummy& operator= (const PingusSoundDummy&);
-};
-
-} // namespace Sound
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/sound/sound_impl.hpp (from rev 2685,
branches/pingus_sdl/src/sound/sound_impl.hxx)
Deleted: branches/pingus_sdl/src/sound/sound_impl.hxx
===================================================================
--- branches/pingus_sdl/src/sound/sound_impl.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/sound/sound_impl.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,51 +0,0 @@
-// $Id: sound_impl.hxx,v 1.0 2005/11/01 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SOUND_IMPL_HXX
-#define HEADER_PINGUS_SOUND_IMPL_HXX
-
-#include "../pingus.hxx"
-
-namespace Sound {
-
-class PingusSoundImpl
-{
-public:
- PingusSoundImpl () { };
- virtual ~PingusSoundImpl () { };
-
- /** Load a music file and play it immediately.
- @param filename The complete filename
- @param volume The volume to play the music with */
- virtual void real_play_music(const std::string & filename, float volume) = 0;
-
- /** Stops playing any music file */
- virtual void real_stop_music() = 0;
-
- /** Load a sound file and play it immediately
- @param filename The complete filename
- @param volume The volume to play the sound at
- @param panning The panning to play the sound with */
- virtual void real_play_sound(const std::string & filename,
-
float volume, float panning) = 0;
-}; // class PingusSoundImpl
-
-} // namespace Sound
-
-#endif
Copied: branches/pingus_sdl/src/sound/sound_real.cpp (from rev 2685,
branches/pingus_sdl/src/sound/sound_real.cxx)
Deleted: branches/pingus_sdl/src/sound/sound_real.cxx
===================================================================
--- branches/pingus_sdl/src/sound/sound_real.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/sound/sound_real.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,157 +0,0 @@
-// $Id: sound_real.cxx,v 1.11 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../globals.hxx"
-#include "../debug.hxx"
-#include "sound_res_mgr.hxx"
-#include "sound_real.hxx"
-
-namespace Sound {
-
-PingusSoundReal::PingusSoundReal ()
- : music_sample (0), music_session(0)
-{
- pout(PINGUS_DEBUG_SOUND) << "Initializing ClanLib-Sound" << std::endl;
-
- sound_output = new CL_SoundOutput(44100);
- CL_SetupSound::init();
-
- pout(PINGUS_DEBUG_SOUND) << "Initializing ClanLib-MikMod" << std::endl;
-
-#ifdef HAVE_LIBCLANVORBIS
- CL_SetupVorbis::init();
-#endif
-
-#ifdef HAVE_LIBCLANMIKMOD
- CL_SetupMikMod::init();
-#endif
-}
-
-PingusSoundReal::~PingusSoundReal()
-{
- real_stop_music();
- SoundResMgr::free_sound_map();
-
-#ifdef HAVE_LIBCLANMIKMOD
- CL_SetupMikMod::deinit();
-#endif
-
-#ifdef HAVE_LIBCLANVORBIS
- CL_SetupVorbis::deinit();
-#endif
-
- CL_SetupSound::deinit();
- sound_output->stop_all();
- delete sound_output;
-}
-
-struct sound_is_finished
-{
- bool operator()(CL_SoundBuffer_Session& sess) {
- return !sess.is_playing();
- }
-};
-
-void
-PingusSoundReal::real_play_sound(const std::string& name, float volume, float
panning)
-{
- if (!sound_enabled)
- return;
-
- SoundHandle buffer;
- CL_SoundBuffer_Session sess;
-
- try {
- buffer = SoundResMgr::load(name);
- sess = buffer->prepare();
- } catch (const CL_Error & e) {
- perr(PINGUS_DEBUG_SOUND) << "Can't open sound '" << name << "' --
skipping\n"
- << " CL_Error: " << e.message << std::endl;
- return;
- }
-
- sess.set_volume(volume);
- sess.set_pan(panning);
- sess.set_looping(false);
- sess.play();
-}
-
-void
-PingusSoundReal::real_stop_music ()
-{
- if (music_session)
- {
- music_session->stop();
- delete music_session;
- music_session = 0;
-
- if (music_sample)
- {
- delete music_sample;
- music_sample = NULL;
- }
- }
-}
-
-void
-PingusSoundReal::real_play_music (const std::string & arg_filename, float
volume)
-{
- std::string filename;
-
- filename = arg_filename;
-
- if (!music_enabled)
- return;
-
- pout(PINGUS_DEBUG_SOUND) << "PingusSoundReal: Playing music: " << filename
<< std::endl;
-
- real_stop_music();
-
- music_sample = 0;
-
- if (filename.substr(filename.size()-4, 4) == ".ogg")
- {
- #ifdef HAVE_LIBCLANVORBIS
- music_sample = new CL_SoundBuffer (filename.c_str());
- #endif
- }
- else if (filename.substr(filename.size()-4, 4) == ".wav")
- {
- music_sample = new CL_SoundBuffer (filename.c_str());
- }
- else
- { // MikMod should support the rest...
- #ifdef HAVE_LIBCLANMIKMOD
- music_sample = new CL_SoundBuffer (filename.c_str());
- #endif
- }
-
- if (music_sample)
- {
- music_session = new CL_SoundBuffer_Session(music_sample->prepare());
- music_session->set_volume(volume * 0.5f); // FIXME: music_volume
- music_session->set_looping(true);
- music_session->play();
- }
-}
-
-} // namespace Sound
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/sound/sound_real.hpp (from rev 2685,
branches/pingus_sdl/src/sound/sound_real.hxx)
Deleted: branches/pingus_sdl/src/sound/sound_real.hxx
===================================================================
--- branches/pingus_sdl/src/sound/sound_real.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/sound/sound_real.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,73 +0,0 @@
-// $Id: sound_real.hxx,v 1.4 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SOUND_REAL_HXX
-#define HEADER_PINGUS_SOUND_REAL_HXX
-
-#include <config.h>
-#include <vector>
-#include "sound_impl.hxx"
-#include "sound.hxx"
-
-class CL_SoundBuffer;
-class CL_SoundBuffer_Session;
-
-namespace Sound {
-
-/** A simple wrapper class around SDL_Mixer, it will init itself
- automatically if a sound is played. */
-class PingusSoundReal : public PingusSoundImpl
-{
-private:
- /** The current music file */
- CL_SoundBuffer * music_sample;
-
- /** Music Controller Session */
- CL_SoundBuffer_Session* music_session;
-
- /** Sound Output object */
- CL_SoundOutput* sound_output;
-
-public:
- PingusSoundReal ();
- virtual ~PingusSoundReal ();
-
- /** Load a music file and play it immediately.
- @param filename The complete filename
- @param volume The volume to play the music with */
- virtual void real_play_music(const std::string & filename, float volume);
-
- virtual void real_stop_music();
-
- /** Load a sound file and play it immediately
- @param filename The complete filename
- @param volume The volume to play the sound at
- @param panning The panning to play the sound with */
- virtual void real_play_sound(const std::string & filename, float volume,
float panning);
-
-private:
- PingusSoundReal (const PingusSoundReal&);
- PingusSoundReal& operator= (const PingusSoundReal&);
-};
-
-} // namespace Sound
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/sound/sound_res_mgr.cpp (from rev 2685,
branches/pingus_sdl/src/sound/sound_res_mgr.cxx)
Deleted: branches/pingus_sdl/src/sound/sound_res_mgr.cxx
===================================================================
--- branches/pingus_sdl/src/sound/sound_res_mgr.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/sound/sound_res_mgr.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,64 +0,0 @@
-// $Id: sound_res_mgr.cxx,v 1.5 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../path_manager.hxx"
-#include "../globals.hxx"
-#include "../debug.hxx"
-#include "sound_res_mgr.hxx"
-
-
-SoundResMgr::SoundMap SoundResMgr::sound_map;
-
-SoundHandle
-SoundResMgr::load(const std::string& name)
-{
-#if 0
- SoundMap::iterator i = sound_map.find(name);
-
- if (i == sound_map.end())
- {
- std::string filename = path_manager.complete("sounds/" + name + ".wav");
- CL_SoundBuffer* buffer = new CL_SoundBuffer (filename, true);
- pout(PINGUS_DEBUG_LOADING) << "SoundResMgr: Loading sound from disk: "
- << name << " -> " << filename << std::endl;
-
- sound_map[name] = buffer;
- return buffer;
- }
- else
- {
- pout(PINGUS_DEBUG_LOADING) << "SoundResMgr: Loading sound from cache: "
<< name << std::endl;
- return i->second;
- }
-#endif
- return 0;
-}
-
-void SoundResMgr::free_sound_map()
-{
-#if 0
- for (SoundMap::iterator i = sound_map.begin(); i != sound_map.end(); ++i)
- {
- delete i->second;
- }
-#endif
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/sound/sound_res_mgr.hpp (from rev 2685,
branches/pingus_sdl/src/sound/sound_res_mgr.hxx)
Deleted: branches/pingus_sdl/src/sound/sound_res_mgr.hxx
===================================================================
--- branches/pingus_sdl/src/sound/sound_res_mgr.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/sound/sound_res_mgr.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,48 +0,0 @@
-// $Id: sound_res_mgr.hxx,v 1.4 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SOUND_RES_MGR_HXX
-#define HEADER_PINGUS_SOUND_RES_MGR_HXX
-
-#include <map>
-
-class CL_SoundBuffer;
-
-typedef CL_SoundBuffer* SoundHandle;
-
-
-/** */
-class SoundResMgr
-{
-private:
- typedef std::map<std::string, CL_SoundBuffer*> SoundMap;
- static SoundMap sound_map;
-
-public:
- static SoundHandle load(const std::string& name);
- static void free_sound_map();
-private:
- SoundResMgr (const SoundResMgr&);
- SoundResMgr& operator= (const SoundResMgr&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/sound/sounds.hpp (from rev 2685,
branches/pingus_sdl/src/sound/sounds.hxx)
Deleted: branches/pingus_sdl/src/sound/sounds.hxx
===================================================================
--- branches/pingus_sdl/src/sound/sounds.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/sound/sounds.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,39 +0,0 @@
-// $Id: sounds.hxx,v 1.3 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SOUNDS_HXX
-#define HEADER_PINGUS_SOUNDS_HXX
-
-#include "../pingus.hxx"
-
-namespace Sound {
-
- enum Name {
- DIGGER,
- PLOP,
- GOODIDEA,
- OHNO,
- TICK
- };
-
-} // namespace Sound
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/start_screen.cpp (from rev 2685,
branches/pingus_sdl/src/start_screen.cxx)
Deleted: branches/pingus_sdl/src/start_screen.cxx
===================================================================
--- branches/pingus_sdl/src/start_screen.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/start_screen.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,249 +0,0 @@
-// $Id: start_screen.cxx,v 1.22 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "gui/gui_manager.hxx"
-#include "gui/surface_button.hxx"
-#include "gui/component.hxx"
-#include "gui/screen_manager.hxx"
-#include "blitter.hxx"
-#include "gettext.h"
-#include "game_session.hxx"
-#include "globals.hxx"
-#include "system.hxx"
-#include "fonts.hxx"
-#include "resource.hxx"
-#include "start_screen.hxx"
-#include "game_time.hxx"
-#include "sound/sound.hxx"
-#include "pingus_level.hxx"
-#include "string_format.hxx"
-#include "gui/display.hxx"
-
-class StartScreenComponent : public GUI::Component
-{
-private:
- PingusLevel plf;
- Sprite background;
- std::string time_str;
- std::string description;
-
-public:
- StartScreenComponent(const PingusLevel& plf);
- void draw(DrawingContext& gc);
- virtual ~StartScreenComponent() {}
-
-private:
- const std::string& format_description(int length);
-};
-
-class StartScreenOkButton : public GUI::SurfaceButton
-{
-private:
- StartScreen* parent;
-public:
- StartScreenOkButton(StartScreen* p)
- : GUI::SurfaceButton(Display::get_width()/2 + 225,
- Display::get_height()/2 + 125,
- ResDescriptor("core/start/ok"),
- ResDescriptor("core/start/ok_clicked"),
- ResDescriptor("core/start/ok_hover")),
- parent(p)
- {
- }
-
- void draw(DrawingContext& gc) {
- SurfaceButton::draw(gc);
- gc.print_center(Fonts::chalk_normal, (float)x_pos + 32, (float)y_pos - 17,
_("Ok"));
- }
-
- void on_click()
- {
- Sound::PingusSound::play_sound("yipee");
- parent->start_game();
- }
-
-
- void on_pointer_enter()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
- }
-};
-
-
-class StartScreenAbortButton
- : public GUI::SurfaceButton
-{
-private:
- StartScreen* parent;
-public:
- StartScreenAbortButton(StartScreen* p)
- : GUI::SurfaceButton(Display::get_width()/2 - 278,
- Display::get_height()/2 + 144,
- ResDescriptor("core/start/back"),
- ResDescriptor("core/start/back_clicked"),
- ResDescriptor("core/start/back_hover")),
- parent(p)
- {
- }
-
- void draw(DrawingContext& gc) {
- SurfaceButton::draw(gc);
- gc.print_center(Fonts::chalk_normal, (float)x_pos + 55, (float)y_pos,
_("Abort"));
- }
-
- void on_click() {
- parent->cancel_game();
- }
-
- void on_pointer_enter()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
- }
-};
-
-StartScreen::~StartScreen()
-{
-
-}
-
-StartScreenComponent::StartScreenComponent(const PingusLevel& p)
- : plf(p)
-{
- if (Display::get_width() == 800 && Display::get_height() == 600)
- {
- background = Resource::load_sprite("core/menu/startscreenbg");
- }
- else
- {
-#if 0
- PixelBuffer pb =
Blitter::scale_surface_to_canvas(Resource::load_pixelbuffer(
-
"core/menu/startscreenbg"), Display::get_width(), Display::get_height());
- CL_SpriteDescription desc;
- desc.add_frame(pb);
- background = CL_Sprite(desc);
-#endif
- }
- ////background.set_alignment(origin_center);
- time_str = GameTime::ticks_to_realtime_string(plf.get_time());
-}
-
-void
-StartScreenComponent::draw(DrawingContext& gc)
-{
- gc.draw(background, Display::get_width()/2, Display::get_height()/2);
-
-#if 0
- int left_x = Display::get_width()/2 - 120;
- int right_x = Display::get_width()/2 + 120;
- int y = Display::get_height()/2 + 40;
-
- gc.print_center(Fonts::chalk_large,
- gc.get_width()/2,
- (float)Display::get_height()/2 - 200,
- _(plf.get_levelname()));
-
- gc.print_left(Fonts::chalk_normal,
- (float)Display::get_width()/2 - 290,
- (float)Display::get_height()/2 - 140,
- format_description(800 - 230));
-
- gc.print_left (Fonts::chalk_normal, (float)left_x, (float)y, _("Number of
Pingus: "));
- gc.print_right(Fonts::chalk_normal, (float)right_x, (float)y,
CL_String::to(plf.get_number_of_pingus()));
-
- gc.print_left (Fonts::chalk_normal, (float)left_x, float(y += 30),
_("Number to Save: "));
- gc.print_right(Fonts::chalk_normal, (float)right_x, (float)y,
CL_String::to(plf.get_number_to_save()));
-
- gc.print_left (Fonts::chalk_normal, (float)left_x, float(y += 30), _("Time:
"));
- gc.print_right(Fonts::chalk_normal, (float)right_x, (float)y, time_str);
-
- gc.print_left (Fonts::chalk_normal, (float)left_x, float(y += 30),
_("Difficulty:"));
- gc.print_right(Fonts::chalk_normal, (float)right_x, (float)y,
CL_String::to(plf.get_difficulty()) + "/100");
-
- gc.print_center(Fonts::chalk_small, (float)Display::get_width()/2,
- (float)Display::get_height()/2 + 270, _("Author: ") +
plf.get_author());
-
- if (maintainer_mode)
- gc.print_left(Fonts::chalk_small, 110, 430, _("Filename: ") +
plf.get_resname());
-
- CL_System::sleep(30);
-#endif
-}
-
-const std::string&
-StartScreenComponent::format_description(int length)
-{
- if (description != "")
- return description;
-
- description = _(plf.get_description());
-
- if (description == "")
- return description;
-
- description = StringFormat::break_line(description, length,
Fonts::chalk_normal);
-
- return description;
-}
-
-
-StartScreen::StartScreen(const PingusLevel& arg_plf)
- : plf(arg_plf)
-{
- StartScreenComponent* comp = new StartScreenComponent(plf);
- gui_manager->add(comp, true);
- gui_manager->add(new StartScreenOkButton(this), true);
- gui_manager->add(new StartScreenAbortButton(this), true);
-}
-
-void
-StartScreen::on_fast_forward_press()
-{
- start_game();
-}
-
-void
-StartScreen::on_pause_press ()
-{
- start_game();
-}
-
-void
-StartScreen::on_escape_press()
-{
- cancel_game();
-}
-
-void
-StartScreen::start_game()
-{
- PingusGameSession* game_session = new PingusGameSession(plf, true);
- ScreenManager::instance()->replace_screen(game_session, true);
-}
-
-void
-StartScreen::cancel_game()
-{
- ScreenManager::instance()->pop_screen();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/start_screen.hpp (from rev 2685,
branches/pingus_sdl/src/start_screen.hxx)
Deleted: branches/pingus_sdl/src/start_screen.hxx
===================================================================
--- branches/pingus_sdl/src/start_screen.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/start_screen.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,53 +0,0 @@
-// $Id: start_screen.hxx,v 1.6 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_START_SCREEN_HXX
-#define HEADER_PINGUS_START_SCREEN_HXX
-
-#include "pingus_level.hxx"
-#include "gui/gui_screen.hxx"
-
-
-/** */
-class StartScreen : public GUIScreen
-{
-private:
- PingusLevel plf;
-
-public:
- StartScreen(const PingusLevel& plf);
- ~StartScreen();
-
- void start_game();
- void cancel_game();
-
- void on_pause_press();
- void on_fast_forward_press();
- void on_escape_press();
-
-private:
-
- StartScreen (const StartScreen&);
- StartScreen& operator= (const StartScreen&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/stat_manager.cpp (from rev 2685,
branches/pingus_sdl/src/stat_manager.cxx)
Deleted: branches/pingus_sdl/src/stat_manager.cxx
===================================================================
--- branches/pingus_sdl/src/stat_manager.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/stat_manager.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,198 +0,0 @@
-// $Id: stat_manager.cxx,v 1.9 2003/10/20 19:28:54 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <algorithm>
-#include <fstream>
-#include "system.hxx"
-#include "pingus_error.hxx"
-////#include "xml_file_reader.hxx"
-#include "stat_manager.hxx"
-
-
-StatManager* StatManager::instance_ = 0;
-
-StatManager*
-StatManager::instance()
-{
- if (instance_)
- return instance_;
- else
- return (instance_ = new StatManager(System::get_statdir() +
"savegames/variables.xml"));
-}
-
-void
-StatManager::init()
-{
- StatManager::instance();
-}
-
-void
-StatManager::deinit()
-{
- instance()->flush();
- delete instance_;
- instance_ = 0;
-}
-
-std::string
-StatManager::get_resname(const std::string& filename)
-{
- std::string::size_type pos;
- std::string str;
- pos = filename.rfind("/");
- pos++;
- str = filename.substr(pos);
- pos = 0;
- while ((pos = str.find('.', pos)) != std::string::npos)
- str.replace(pos, 1, 1, '-');
- return str;
-}
-
-StatManager::StatManager(const std::string& arg_filename)
- : statfilename(arg_filename)
-{
- load(statfilename);
-}
-
-StatManager::~StatManager()
-{
-}
-
-void
-StatManager::load(const std::string& filename)
-{
- if (!System::exist(filename))
- {
- // Create empty file
- save(filename);
- }
-
-#if 0
- CL_InputSourceProvider_File provider(".");
- CL_DomDocument doc(provider.open_source(filename), true);
-
- CL_DomElement root = doc.get_document_element();
-
- if (root.get_tag_name() != "pingus-stats")
- {
- PingusError::raise("Error: " + filename + ": not a <pingus-stats> file");
- }
- else
- {
- XMLFileReader reader(root);
- const std::vector<std::string>& section_names =
reader.get_section_names();
- for(std::vector<std::string>::const_iterator i = section_names.begin();
- i != section_names.end(); ++i)
- {
- reader.read_string(i->c_str(), stats[*i]);
- }
- }
-#endif
-}
-
-void
-StatManager::flush()
-{
- save(statfilename);
-}
-
-void
-StatManager::save(const std::string& filename)
-{
- std::ofstream xml(filename.c_str());
-
- xml << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n"
- << "<pingus-stats>\n";
-
- for (Table::iterator i = stats.begin(); i != stats.end(); ++i)
- {
- if (!i->second.empty())
- xml << " <" << i->first << ">" << i->second << "</" << i->first <<
">" << std::endl;
- }
-
- xml << "</pingus-stats>\n";
-}
-
-bool
-StatManager::get_int(const std::string& name, int& value)
-{
-#if 0
- std::string str;
- if (get_string(name, str))
- return CL_String::from(str, value);
- else
-#endif
- return false;
-}
-
-bool
-StatManager::get_bool(const std::string& name, bool& value)
-{
-#if 0
- std::string str;
- if (get_string(name, str))
- return CL_String::from(str, value);
- else
-#endif
- return false;
-}
-
-bool
-StatManager::get_string(const std::string& name, std::string& value)
-{
- Table::iterator i = stats.find(name);
- if (i == stats.end())
- {
- return false;
- }
- else
- {
- value = i->second;
- return true;
- }
-}
-
-void
-StatManager::set_string(const std::string& name, const std::string& value)
-{
- stats[name] = value;
- flush();
-}
-
-void
-StatManager::set_int(const std::string& name, int value)
-{
-#if 0
- stats[name] = CL_String::to(value);
-#endif
- flush();
-}
-
-void
-StatManager::set_bool(const std::string& name, bool value)
-{
-#if 0
- stats[name] = CL_String::to(value);
-#endif
- flush();
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/stat_manager.hpp (from rev 2685,
branches/pingus_sdl/src/stat_manager.hxx)
Deleted: branches/pingus_sdl/src/stat_manager.hxx
===================================================================
--- branches/pingus_sdl/src/stat_manager.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/stat_manager.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,71 +0,0 @@
-// $Id: stat_manager.hxx,v 1.3 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_STAT_MANAGER_HXX
-#define HEADER_PINGUS_STAT_MANAGER_HXX
-
-#include <map>
-#include <string>
-
-
-/** */
-class StatManager
-{
-private:
- static StatManager* instance_;
-
- /** File from which it loads/saves the stats */
- std::string statfilename;
- typedef std::map<std::string, std::string> Table;
- Table stats;
-
-public:
- static StatManager* instance();
- static void init();
- static void deinit();
-
- /** Returns the resource name of a worldmap - strips out everything
except after
- the last '/' in the full path + filename, and converts periods
to dashes */
- static std::string get_resname(const std::string& filename);
-
- StatManager(const std::string& filename);
- ~StatManager();
-
- bool get_int (const std::string&, int& value);
- bool get_bool (const std::string&, bool& value);
- bool get_string(const std::string&, std::string& vlaue);
-
- void set_string(const std::string& name, const std::string& value);
- void set_int (const std::string& name, int value);
- void set_bool (const std::string& name, bool value);
-
- /** Write the current status down */
- void flush();
-
- void load(const std::string& filename);
- void save(const std::string& filename);
-private:
- StatManager (const StatManager&);
- StatManager& operator= (const StatManager&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/state_sprite.cpp (from rev 2685,
branches/pingus_sdl/src/state_sprite.cxx)
Deleted: branches/pingus_sdl/src/state_sprite.cxx
===================================================================
--- branches/pingus_sdl/src/state_sprite.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/state_sprite.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,69 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "resource.hxx"
-#include "pingus_error.hxx"
-#include "state_sprite.hxx"
-
-
-StateSprite::StateSprite()
-{
-}
-
-void
-StateSprite::load(int state, const std::string& name)
-{
- load(state, Resource::load_sprite(name));
-}
-
-void
-StateSprite::load(int state, Sprite sprite)
-{
- sprites[state] = sprite;
-}
-
-void
-StateSprite::update()
-{
- update(0.033f);
-}
-
-void
-StateSprite::update(float delta)
-{
- for(Sprites::iterator i = sprites.begin(); i != sprites.end(); ++i)
- (*i).second.update(delta);
-}
-
-Sprite&
-StateSprite::operator[](int state)
-{
- Sprites::iterator i = sprites.find(state);
- if (i != sprites.end())
- {
- return i->second;
- }
- else
- {
- throw PingusError("StateSprite error");
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/state_sprite.hpp (from rev 2685,
branches/pingus_sdl/src/state_sprite.hxx)
Deleted: branches/pingus_sdl/src/state_sprite.hxx
===================================================================
--- branches/pingus_sdl/src/state_sprite.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/state_sprite.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,48 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_STATE_SPRITE_HXX
-#define HEADER_STATE_SPRITE_HXX
-
-#include <map>
-#include "sprite.hpp"
-
-/** Simple Wrapper class around Sprite that allows to have multiple
- sprites for different states (running, walking, left, right) */
-class StateSprite
-{
-private:
- typedef std::map<int, Sprite> Sprites;
- Sprites sprites;
-
-public:
- StateSprite();
-
- void update(float delta);
- void update();
-
- void load(int state, const std::string& name);
- void load(int state, Sprite);
- Sprite& operator[](int state);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/story_screen.cpp (from rev 2685,
branches/pingus_sdl/src/story_screen.cxx)
Deleted: branches/pingus_sdl/src/story_screen.cxx
===================================================================
--- branches/pingus_sdl/src/story_screen.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/story_screen.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,219 +0,0 @@
-// $Id: story_screen.cxx,v 1.25 2003/10/22 11:11:22 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <algorithm>
-#include <vector>
-#include "gettext.h"
-#include "resource.hxx"
-#include "gui/gui_manager.hxx"
-#include "gui/surface_button.hxx"
-#include "gui/screen_manager.hxx"
-#include "gui/component.hxx"
-#include "math.hxx"
-#include "pingus_menu_manager.hxx"
-#include "fonts.hxx"
-#include "story_screen.hxx"
-#include "res_descriptor.hxx"
-#include "worldmap/worldmap.hxx"
-#include "worldmap/manager.hxx"
-#include "worldmap/worldmap_story.hxx"
-#include "stat_manager.hxx"
-#include "credits.hxx"
-#include "sound/sound.hxx"
-
-
-class StoryScreenComponent : public GUI::Component
-{
-private:
- Sprite background;
- std::string display_text;
- float time_passed;
-
- bool page_displayed_completly;
-
- WorldMapNS::WorldMapStory *story;
- std::vector<StoryPage> pages;
- Sprite page_surface;
- StoryPage current_page;
-public:
- StoryScreenComponent (WorldMapNS::WorldMapStory *arg_pages);
- virtual ~StoryScreenComponent () {}
-
- void draw (DrawingContext& gc);
- void update(float delta);
-
- /** starts to display the next text page */
- void next_text();
- WorldMapNS::WorldMapStory* get_story() const { return story; }
-};
-
-class StoryScreenContinueButton : public GUI::SurfaceButton
-{
-private:
- StoryScreenComponent* story_comp;
-public:
- StoryScreenContinueButton(StoryScreenComponent* arg_story_comp)
- : GUI::SurfaceButton(Display::get_width()/2 + 220, Display::get_height()/2
+ 160,
- ResDescriptor("core/misc/next"),
- ResDescriptor("core/misc/next"),
- ResDescriptor("core/misc/next_hover")),
- story_comp(arg_story_comp)
- {
- }
-
- void on_pointer_enter()
- {
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick", 0.3f);
- }
-
- void on_click()
- {
- story_comp->next_text();
- }
-};
-
-
-StoryScreen::StoryScreen(WorldMapNS::WorldMapStory *arg_pages)
-{
- story_comp = new StoryScreenComponent(arg_pages);
- gui_manager->add (story_comp, true);
- gui_manager->add (new StoryScreenContinueButton(story_comp), true);
-}
-
-StoryScreen::~StoryScreen()
-{
-}
-
-StoryScreenComponent::StoryScreenComponent (WorldMapNS::WorldMapStory
*arg_story)
- : story(arg_story)
-{
- page_displayed_completly = false;
- time_passed = 0;
- pages = story->get_pages();
-
- current_page = pages.back();
- page_surface = Resource::load_sprite(current_page.image);
- background = Resource::load_sprite("core/menu/startscreenbg");
-}
-
-void
-StoryScreenComponent::draw (DrawingContext& gc)
-{
- gc.draw(background, Vector3f(gc.get_width()/2, gc.get_height()/2));
-
- gc.print_center(Fonts::chalk_large,
static_cast<float>(Display::get_width()/2),
- static_cast<float>(Display::get_height()/2 - 200),
story->get_title());
- gc.draw(page_surface, Vector3f(gc.get_width()/2, gc.get_height()/2 - 65));
-
- gc.print_left(Fonts::chalk_normal,
- static_cast<float>(Display::get_width()/2 - 280),
- static_cast<float>(Display::get_height()/2 + 35),
- display_text);
-}
-
-void
-StoryScreenComponent::update(float delta)
-{
- time_passed += delta;
-
- if (!page_displayed_completly)
- {
- std::string::size_type len = static_cast<std::string::size_type>(20.0f *
time_passed);
- display_text = current_page.text.substr(0,
Math::min(current_page.text.length(), len));
-
- if (current_page.text.length() < len)
- {
- page_displayed_completly = true;
- }
- }
-}
-
-void
-StoryScreen::on_fast_forward_press ()
-{
- story_comp->next_text();
-}
-
-void
-StoryScreen::on_escape_press ()
-{
-
ScreenManager::instance()->replace_screen(WorldMapNS::WorldMapManager::instance
());
-}
-
-void
-StoryScreen::on_startup()
-{
- // FIXME: Load the song from the WorldMapStory
- Sound::PingusSound::play_music(story_comp->get_story()->get_music(), .7f);
-}
-
-void
-StoryScreenComponent::next_text()
-{
- if (!page_displayed_completly)
- {
- page_displayed_completly = true;
- display_text = current_page.text;
- }
- else
- {
- pages.pop_back();
- if (!pages.empty())
- {
- current_page = pages.back();
- page_surface = Resource::load_sprite(current_page.image);
- display_text = "";
- time_passed = 0;
- page_displayed_completly = false;
- }
- else
- {
- //Out of story pages - figure out which one this was (start or end)
- std::string which_story;
- if (story ==
WorldMapNS::WorldMapManager::instance()->get_worldmap()->get_intro_story())
- which_story = "start";
- else
- which_story = "end";
-
- // Record that player has seen this story.
-
StatManager::instance()->set_bool(WorldMapNS::WorldMapManager::instance()->get_worldmap()->get_shortname()
- + "-" + which_story +
"story-seen", true);
-
- bool credits_seen = false;
- //Check if this is the last worldmap
- if (which_story == "end" &&
-
WorldMapNS::WorldMapManager::instance()->get_worldmap()->is_final_map())
- {
- // Check if final credits have been seen
- StatManager::instance()->get_bool("credits-seen", credits_seen);
- if (!credits_seen)
- ScreenManager::instance()->replace_screen(Credits::instance(),
false);
- }
-
ScreenManager::instance()->replace_screen(WorldMapNS::WorldMapManager::instance
());
- }
- }
-}
-
-
-// Local Variables: ***
-// coding:iso-latin-1
-// End: ***
-
-/* EOF */
Copied: branches/pingus_sdl/src/story_screen.hpp (from rev 2685,
branches/pingus_sdl/src/story_screen.hxx)
Deleted: branches/pingus_sdl/src/story_screen.hxx
===================================================================
--- branches/pingus_sdl/src/story_screen.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/story_screen.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,53 +0,0 @@
-// $Id: story_screen.hxx,v 1.7 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_STORY_SCREEN_HXX
-#define HEADER_PINGUS_STORY_SCREEN_HXX
-
-#include <string>
-#include "res_descriptor.hxx"
-#include "gui/gui_screen.hxx"
-#include "worldmap/worldmap_story.hxx"
-
-
-class StoryScreenComponent;
-
-using namespace WorldMapNS;
-
-/** */
-class StoryScreen : public GUIScreen
-{
-private:
- StoryScreenComponent* story_comp;
-public:
- StoryScreen(WorldMapStory *pages);
- ~StoryScreen();
-
- void on_startup();
- void on_fast_forward_press ();
- void on_escape_press ();
-private:
- StoryScreen (const StoryScreen&);
- StoryScreen& operator= (const StoryScreen&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/string_format.cpp (from rev 2685,
branches/pingus_sdl/src/string_format.cxx)
Deleted: branches/pingus_sdl/src/string_format.cxx
===================================================================
--- branches/pingus_sdl/src/string_format.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/string_format.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,89 +0,0 @@
-// $Id: string_format.cxx,v 1.4 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "font.hpp"
-#include "string_format.hxx"
-
-
-std::string
-StringFormat::break_line (std::string text, int length, const Font& font)
-{
- std::string::size_type pos = 0;
- while ((pos = text.find('\t', pos)) != std::string::npos)
- text.replace(pos, 1, 1, ' ');
-
- pos = 0;
- while ((pos = text.find(" ", pos)) != std::string::npos)
- text.replace(pos, 2, 1, ' ');
-
- pos = 0;
- while ((pos = text.find('\n', pos)) != std::string::npos)
- {
- if (pos < text.length() && text[pos + 1] == '\n') // double enter
marks paragraph
- {
- text.replace(pos, 2, 1, '\n'); // replace the two \n
by one
- }
- else if (pos < text.length() - 1 && text[pos + 1] == ' ' && text[pos +
2] == '\n')
- {
- text.replace(pos, 3, 1, '\n'); // whitespace between
the two \n doesn't matter
- }
- else
- {
- text.replace(pos, 1, 1, ' ');
- continue; // no \n here
anymore, so continue searching
- }
-
- if (pos && text[pos - 1] == ' ')
- text.replace(pos - 1, 2, 1, '\n'); // no whitespace in
front
-
- if (pos < text.length() && text[pos + 1] == ' ')
- text.replace(pos, 2, 1, '\n'); // no whitespace
behind
-
- ++pos; // we don't want to
find it again
- }
-
- pos = 0;
- while ((pos = text.find(" ", pos)) != std::string::npos)
- text.replace(pos, 2, 1, ' ');
-
- int start_pos = 0;
- int previous_space = 0;
- pos = 0;
-
- while ((pos = text.find(' ', pos + 1)) != std::string::npos)
- {
- if (font.bounding_rect(0, 0, (text.substr(start_pos, pos -
start_pos))).get_width() > length)
- {
- text[previous_space] = '\n';
- start_pos = previous_space + 1;
- }
- else if (font.bounding_rect(0, 0, text.substr(start_pos,
text.length())).get_width() <= length)
- break;
-
- previous_space = pos;
- }
-
- if (font.bounding_rect(0, 0, text.substr(start_pos, text.length() -
start_pos)).get_width() > length)
- text[text.rfind(' ')] = '\n';
-
- return text;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/string_format.hpp (from rev 2685,
branches/pingus_sdl/src/string_format.hxx)
Deleted: branches/pingus_sdl/src/string_format.hxx
===================================================================
--- branches/pingus_sdl/src/string_format.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/string_format.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,36 +0,0 @@
-// $Id: string_format.hxx,v 1.3 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_STRING_FORMAT_HXX
-#define HEADER_PINGUS_STRING_FORMAT_HXX
-
-#include <string>
-
-class Font;
-
-class StringFormat {
-
-public:
- static std::string break_line (std::string text, int length, const Font&
font);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/system.cpp (from rev 2685,
branches/pingus_sdl/src/system.cxx)
Deleted: branches/pingus_sdl/src/system.cxx
===================================================================
--- branches/pingus_sdl/src/system.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/system.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,480 +0,0 @@
-// $Id: system.cxx,v 1.23 2003/12/13 11:21:23 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <stdio.h>
-#include <locale.h>
-
-#ifndef WIN32
-# include <dirent.h>
-# include <fcntl.h>
-# include <fnmatch.h>
-# include <sys/stat.h>
-# include <sys/types.h>
-# include <unistd.h>
-# include <errno.h>
-#else /* WIN32 */
-# include <windows.h>
-# include <direct.h>
-# include <fstream>
-#endif
-
-#include <iostream>
-#include <sstream>
-
-#include "pingus_error.hxx"
-#include "globals.hxx"
-#include "system.hxx"
-#include "gettext.h"
-
-
-int System::verbose;
-std::string System::default_email;
-std::string System::default_username;
-
-System::DirectoryEntry::DirectoryEntry(const std::string& n, FileType t)
- : type (t), name (n)
-{
-}
-
-System::Directory
-System::opendir(const std::string& pathname, const std::string& pattern)
-{
- std::list<System::DirectoryEntry> dir_list;
-
-#ifndef WIN32
- DIR* dp;
- dirent* de;
-
- dp = ::opendir(pathname.c_str());
-
- if (dp == 0)
- {
- std::cout << "System: Couldn't open: " << pathname << std::endl;
- }
- else
- {
- while ((de = ::readdir(dp)) != 0)
- {
- if (fnmatch(pattern.c_str(), de->d_name, FNM_PATHNAME) == 0)
- {
- struct stat buf;
- stat ((pathname + "/" + de->d_name).c_str (), &buf);
-
- if (S_ISDIR(buf.st_mode))
- {
- dir_list.push_back(DirectoryEntry(de->d_name,
DirectoryEntry::DE_DIRECTORY));
- }
- else
- {
- dir_list.push_back(DirectoryEntry(de->d_name,
DirectoryEntry::DE_FILE));
- }
- }
- }
-
- closedir(dp);
- }
-#else /* WIN32 */
- WIN32_FIND_DATA coFindData;
- std::string FindFileDir = pathname + "\\" + pattern;
- std::string FileLocation;
- HANDLE hFind = FindFirstFile(TEXT(FindFileDir.c_str()),&coFindData);
-
- if (hFind == INVALID_HANDLE_VALUE)
- {
- std::cout << "System: Couldn't open: " << pathname << std::endl;
- }
-
- do
- {
- dir_list.push_back(DirectoryEntry(coFindData.cFileName));
- }
- while (FindNextFile(hFind,&coFindData));
-
- FindClose(hFind);
-#endif
-
- return dir_list;
-}
-
-// Returns the basic filename without the path
-std::string
-System::basename(std::string filename)
-{
- // Should be replaced with STL
- const char* str = filename.c_str();
- int i;
-
- for(i = (int)filename.size() - 1; i >= 0; --i)
- {
- if (*(str + i) == '/') {
- break;
- }
- }
-
- return (str+i + 1);
-}
-
-std::string
-System::dirname (std::string filename)
-{
- const char* str = filename.c_str();
- int i;
-
- for(i = (int)filename.size() - 1; i >= 0; --i)
- {
- if (*(str + i) == '/') {
- break;
- }
- }
-
- return filename.substr(0, i);
-}
-
-std::string
-System::extension (std::string filename)
-{
- const char* str = filename.c_str ();
- int i;
- int last_char = (int)filename.size() - 1;
-
- for(i = last_char; i >= 0; --i)
- {
- if (str[i] == '.' ) {
- if (i != last_char)
- return filename.substr (i+1);
- else
- return "";
- } else if (str[i] == '/' ) {
- return "";
- }
- }
- return "";
-}
-
-bool
-System::exist(std::string filename)
-{
-#ifndef WIN32
- return !access(filename.c_str(), F_OK);
-#else
- //don't know a better solution
- std::ifstream check(filename.c_str());
- if(!check) return false;
- return true;
-#endif
-}
-
-void
-System::create_dir(std::string directory)
-{
-#ifndef WIN32
- if (pingus_debug_flags & PINGUS_DEBUG_DIRECTORIES)
- {
- std::cout << "System::create_dir: " << directory << std::endl;
- }
-
- if (!exist(directory))
- {
- if (mkdir(directory.c_str(), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP |
S_IXGRP) != 0)
- {
- throw PingusError("System::create_dir: " + directory + ": " +
strerror(errno));
- }
- else
- {
- std::cout << "Successfully created: " << directory << std::endl;
- }
- }
- else
- {
- if (verbose) std::cout << "Found: " << directory << std::endl;
- }
-#else
- CreateDirectory(directory.c_str(), 0);
-#endif
-}
-
-/** Change into the directory named dir, on error throw an PingusError */
-void
-System::change_dir (std::string dir)
-{
- std::cout << "System: change_dir: " << dir << std::endl;
-#ifdef WIN32
- _chdir (dir.c_str ());
-#else
- chdir (dir.c_str ());
-#endif
-}
-
-void
-System::init_directories()
-{
- std::string statdir = get_statdir();
- std::string vardir = get_vardir();
-
- create_dir(statdir);
-
- // FIXME: We need a better seperation between user created levels,
- // FIXME: third party levels and levels from the base distri
- create_dir(statdir + "levels/");
- create_dir(statdir + "levels/dist");
- create_dir(statdir + "themes/");
-
- // Savegames (FIXME: rename to savegames/?)
- create_dir(statdir + "savegames/");
-
- // User created images
- create_dir(statdir + "images/");
-
- // Thumbnail cache
- create_dir(statdir + "cache/");
-
- // Recorded demos will per default be writen in this directory
- create_dir(statdir + "demos/");
-
- // Screenshots will be dumped to that directory:
- create_dir(statdir + "screenshots/");
- // create_dir(vardir);
-}
-
-std::string
-System::get_statdir()
-{
-#ifdef WIN32
- std::string tmpstr;
- char* homedir = getenv("HOMEDRIVE");
- if (homedir)
- {
- tmpstr = std::string(homedir);
- homedir = 0;
- homedir = getenv("HOMEPATH");
- tmpstr = tmpstr + std::string(homedir) + "/.pingus/";
- }
- else
- tmpstr = "user/";
- return tmpstr;
-
-#else /* !WIN32 */
- char* homedir = getenv("HOME");
-
- if (homedir)
- {
- return std::string(homedir) + "/.pingus/";
- }
- else
- {
- throw PingusError(_("Environment variable $HOME not set, fix that and
start again."));
- }
-#endif
-}
-
-std::string
-System::get_cachedir()
-{
- return get_statdir() + "cache/";
-}
-
-std::string
-System::get_vardir()
-{
-#ifdef WIN32
- return "var/";
-#else
- return "/var/games/pingus/";
-#endif
-}
-
-std::string
-System::get_tmpdir()
-{
-#ifdef WIN32
- char* tmpdir = getenv("TEMP");
- if (!tmpdir) tmpdir = getenv("TMP");
- if (!tmpdir) return get_statdir() + "tmp/";
- else return std::string(tmpdir);
-#else
- return "/tmp/";
-#endif
-}
-
-/** Returns the username of the current user or an empty string */
-std::string
-System::get_username()
-{
- if (default_username.empty())
- {
- char* username = getenv("USERNAME");
-
- if (username)
- return std::string(username);
- else
- return "";
- }
- else
- {
- return default_username;
- }
-}
-
-/** Returns the EMail of the user or an empty string */
-std::string
-System::get_email()
-{
- if (default_email.empty())
- {
- char* email = getenv("EMAIL");
-
- if (email)
- // FIXME: $EMAIL contains the complete from header, not only
- // the email address
- return std::string(email);
- else
- return "";
- }
- else
- {
- return default_email;
- }
-}
-
-std::string
-System::get_language()
-{
-#ifdef WIN32
- char* lang_c = getenv ("LC_MESSAGES");
-#else
- char* lang_c = setlocale(LC_MESSAGES, NULL);
-#endif
-
- std::string lang;
-
- if (lang_c)
- lang = lang_c;
-
- if (lang.empty() || lang == "C")
- return default_language;
- else
- return lang.substr(0, 2);
-}
-
-std::string
-System::translate(const std::map<std::string, std::string>& strs)
-{
- if (pingus_debug_flags & PINGUS_DEBUG_TRANSLATOR)
- {
- std::cout << ",-- [ Translator: lang=" << System::get_language ()
- << " default=" << default_language << " ] --" << std::endl;
- for (std::map<std::string, std::string>::const_iterator i = strs.begin
();
- i != strs.end (); ++i)
- {
- std::cout << "| [" << i->first << "] ->" << i->second << std::endl;
- }
- std::cout << "`-- [ End Translator ] -----------------------" <<
std::endl;
- }
-
- std::map<std::string, std::string>::const_iterator p =
strs.find(System::get_language());
-
- if (p == strs.end ())
- { // No native-language text found, fallback to default
- return translate_default(strs);
- }
- else
- { // Native language was empty, try default fallback
- if (p->second.empty())
- {
- return translate_default(strs);
- }
- else
- {
- return p->second;
- }
- }
-}
-
-std::string
-System::translate_default(const std::map<std::string, std::string>& strs)
-{
- std::map<std::string, std::string>::const_iterator default_text =
strs.find(default_language);
-
- if (default_text == strs.end())
- { // no 'en' default text given probally a bug in the level data
- return "<Translation Bug: no 'en' text given>";
- }
- else
- {
- return default_text->second;
- }
-}
-
-/** Read file and create a checksum and return it */
-std::string
-System::checksum (std::string filename)
-{
- FILE* in;
- int bytes_read;
- char buffer[4096];
- long int checksum = 0;
-
- in = fopen(filename.c_str(), "r");
-
- if (!in)
- {
- std::cout << "System::checksum: Couldn't open file: " << filename <<
std::endl;
- return "";
- }
-
- do
- {
- bytes_read = fread (buffer, sizeof (char), 4096, in);
-
- if (bytes_read == -1)
- {
- throw PingusError("System:checksum: file read error");
- }
-
- for (int i=0; i < bytes_read; ++i)
- checksum = checksum * 17 + buffer[i];
- }
- while (bytes_read != 0);
-
- fclose (in);
-
- std::ostringstream str;
- str << checksum;
- return str.str();
-}
-
-
-unsigned int
-System::get_mtime(const std::string& filename)
-{
-#ifndef WIN32
-
- struct stat stat_buf;
- if (stat(filename.c_str(), &stat_buf) == 0)
- return stat_buf.st_mtime;
- else
- return 0;
-
-#else
- return 0;
-#endif
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/system.hpp (from rev 2685,
branches/pingus_sdl/src/system.hxx)
Deleted: branches/pingus_sdl/src/system.hxx
===================================================================
--- branches/pingus_sdl/src/system.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/system.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,137 +0,0 @@
-// $Id: system.hxx,v 1.12 2003/12/13 11:21:23 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SYSTEM_HXX
-#define HEADER_PINGUS_SYSTEM_HXX
-
-#include "pingus.hxx"
-#include <string>
-#include <list>
-#include <map>
-
-
-/** A wrapper class around some system dependend functions (mostly
- POSIX stuff) */
-class System
-{
-private:
- static int verbose;
- static std::string default_email;
- static std::string default_username;
-public:
- struct DirectoryEntry
- {
- enum FileType { DE_DIRECTORY, DE_FILE } type;
- std::string name;
-
- DirectoryEntry(const std::string&, FileType t = DE_FILE);
- };
-
- ///
- typedef std::list<DirectoryEntry> Directory;
- typedef std::list<DirectoryEntry>::iterator DirectoryIter;
-
- ///
- static Directory opendir(const std::string& pathname, const std::string&
pattern = "*");
-
- /** Check if a file is avaiblable (no checking for permissens is currently
performed)
- @param filename The name of the file
- @return True, if the file exist, false otherwise */
- static bool exist(std::string filename);
-
- /** Creates directory if it does not already exist.
- @param dir The name of the directory */
- static void create_dir(std::string dir);
-
- /** Change into the directory named dir, on error throw an PingusError */
- static void change_dir (std::string dir);
-
- /** Check if all needed directories are available, if not then create
- them. */
- static void init_directories();
-
- /** Strips directory from filenames
- @param filename The complete filename */
- static std::string basename(std::string filename);
-
- /** Strips basename from pathnames (see dirname(3))
- @param filename The complete filename */
- static std::string dirname(std::string filename);
-
- /** Return the extension of the given filename:
-
- System::extension ("foobar.jpg") => "jpg"
- System::extension ("/bla/bla.blub/") => ""
- System::extension ("/bla/blabl") => ""
- */
- static std::string extension (std::string filename);
-
- /** Returns the directory where Pingus can store its user specific
- state and config data (savegames, config files, demos, etc.) */
- static std::string get_statdir();
-
- /** Returns the directory where Pingus can store things that needs
- to be cached, for example thumbnails */
- static std::string get_cachedir();
-
- /** Returns the directory were Pingus can store its system wide
- variable game data (highscores, cache images, ...) */
- static std::string get_vardir();
-
- /** Asks different variables to check were the directory for
- temporary files is located
- @return The location of the tmp directory */
- static std::string get_tmpdir();
-
- /** Returns the Username how the current user or an empty string */
- static std::string get_username();
-
- /** Returns the EMail of the user or an empty string */
- static std::string get_email();
-
- /** Get the currently country code, in a two letter ISO 639 syntax */
- static std::string get_language();
-
- /** Return the modification time of a file */
- static unsigned int get_mtime(const std::string& filename);
-
- /** Choose the correct translation out of the map, if there is none
- present, fall back to the default language */
- static std::string translate(const std::map<std::string, std::string>& strs);
-
- static std::string translate(const std::string& str);
-
- /** Translate to 'en' */
- static std::string translate_default(const std::map<std::string,
std::string>& strs);
-
- /** Read a file and generate a checksum and return it. The checksum
- generation is very primitiv and should probably be replaced by CRC
- or md5. */
- static std::string checksum (std::string filename);
-
-private:
- System (const System&);
- System& operator= (const System&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/target_provider.cpp (from rev 2685,
branches/pingus_sdl/src/target_provider.cxx)
Deleted: branches/pingus_sdl/src/target_provider.cxx
===================================================================
--- branches/pingus_sdl/src/target_provider.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/target_provider.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,43 +0,0 @@
-// $Id: target_provider.cxx,v 1.4 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <ClanLib/Display/pixel_buffer.h>
-#include "target_provider.hxx"
-
-
-CL_Canvas*
-TargetProvider::create_canvas (CL_Target* target)
-{
- CL_Canvas* canvas;
- float r, g, b, a;
-
- canvas = new CL_Canvas (target->get_width (), target->get_height ());
-
- for (int y_pos = 0; y_pos < (int) canvas->get_height (); y_pos++)
- for (int x_pos = 0; x_pos < (int) canvas->get_width (); x_pos++)
- {
- target->get_pixel (x_pos, y_pos, &r, &g, &b, &a);
- canvas->draw_pixel (x_pos, y_pos, r, g, b);
- }
-
- return canvas;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/target_provider.hpp (from rev 2685,
branches/pingus_sdl/src/target_provider.hxx)
Deleted: branches/pingus_sdl/src/target_provider.hxx
===================================================================
--- branches/pingus_sdl/src/target_provider.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/target_provider.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,67 +0,0 @@
-// $Id: target_provider.hxx,v 1.8 2003/10/20 19:28:54 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_TARGET_PROVIDER_HXX
-#define HEADER_PINGUS_TARGET_PROVIDER_HXX
-
-#include "pingus.hxx"
-#include <ClanLib/Display/pixel_buffer.h>
-
-class CL_Target;
-class CL_Palette;
-class CL_Canvas;
-
-
-class TargetProvider : public PixelBuffer
-{
-private:
- CL_Target* target;
- TargetProvider () {}
-
-public:
- TargetProvider (CL_Target* t) { target = t; }
- virtual ~TargetProvider () {}
-
- void lock () { target->lock(); }
- void unlock () { target->unlock(); }
- void* get_data () const { return target->get_data (); }
- bool is_indexed () const { return target->get_type() == pixelformat_index;
}
- unsigned int get_num_frames () const { return target->get_num_frames (); }
- unsigned int get_width () const { return target->get_width (); }
- unsigned int get_height () const { return target->get_height (); }
- unsigned int get_pitch () const { return target->get_pitch (); }
- unsigned int get_red_mask () const { return target->get_red_mask (); }
- unsigned int get_green_mask () const { return target->get_green_mask (); }
- unsigned int get_blue_mask () const { return target->get_blue_mask (); }
- unsigned int get_alpha_mask () const { return target->get_alpha_mask (); }
- CL_Palette* get_palette () const { return target->get_palette (); }
- bool uses_src_colorkey() const { return false; }
- unsigned int get_src_colorkey () const { return 0; }
-
- static CL_Canvas* create_canvas (CL_Target*);
-
-private:
- TargetProvider (const TargetProvider&);
- TargetProvider& operator= (const TargetProvider&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/theme.cpp (from rev 2685,
branches/pingus_sdl/src/theme.cxx)
Deleted: branches/pingus_sdl/src/theme.cxx
===================================================================
--- branches/pingus_sdl/src/theme.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/theme.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,353 +0,0 @@
- // $Id: theme.cxx,v 1.23 2003/10/22 11:11:22 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <fstream>
-#include <iostream>
-#include <ClanLib/Core/System/error.h>
-#include <ClanLib/Display/display.h>
-#include <ClanLib/Display/font.h>
-#include <ClanLib/Display/keyboard.h>
-#include "path_manager.hxx"
-#include "gettext.h"
-#include "system.hxx"
-#include "resource.hxx"
-#include "pingus_error.hxx"
-#include "plf_res_mgr.hxx"
-#include "game_session.hxx"
-#include "globals.hxx"
-#include "theme.hxx"
-#include "xml_pingus_level.hxx"
-#include "fonts.hxx"
-#include "gui/screen_manager.hxx"
-
-
-Theme::Theme (const std::string& filename_)
- : font(Fonts::pingus_small),
- title(Fonts::pingus_large),
- filename (filename_),
- is_loaded(false)
-{
-}
-
-Theme::~Theme ()
-{
-}
-
-void
-Theme::load (const std::string& filename)
-{
- if (verbose) std::cout << "Theme: loading: " << filename << std::endl;
- plt.parse(filename);
-
- title_name = _(plt.get_name());
-
- level_filenames = plt.get_levels();
- load_levels();
-
- if (_(plt.get_description()) != "-")
- {
- description.set_font(font);
- description.set_text(_(plt.get_description()), 350);
- has_description = true;
- }
- else
- {
- has_description = false;
- }
-
- try
- {
- //if (plt.get_background().desc.res_name != "-")
- background = Resource::load_surface("textures/default");
- }
- catch (CL_Error& err)
- {
- if (verbose)
- {
- std::cout << "Theme:" << filename << ":" << err.message << std::endl;
- std::cout << "Theme: Ignoring missing resource, disable background."
<< std::endl;
- }
- }
- load_status(filename);
-}
-
-int
-Theme::mark_level_at_point(int x, int y)
-{
-#ifdef CLANLIB_0_6
- preload ();
-
- int j = 0;
- int y_pos = level_start_y_pos;
-
- for(std::vector<std::string>::iterator i = levelnames.begin();
- i < levelnames.end();
- ++i, ++j)
- {
- int width = font.get_text_width(i->c_str());
-
- if ((CL_Display::get_width()/2 - width/2) < x
- && (CL_Display::get_width()/2 + width/2) > x
- && y_pos < y
- && (y_pos + font.get_height()) > y)
- {
- if (j <= accessible_levels)
- {
- current_level = j;
- // std::cout << "Current_level: " << current_level << std::endl;
- return current_level;
- }
- return -1;
- }
- y_pos += font.get_height() + 4;
- }
-#endif
- return -1;
-}
-
-void
-Theme::draw_title()
-{
-#ifdef CLANLIB_0_6
- preload ();
-
- int x_center = CL_Display::get_width() / 2;
- int x_pos = x_center;
- int y_pos = 10;
-
- if (!background)
- {
- CL_Display::clear();
- }
- else
- {
- // Fill the screen with the background surface
- for(int y=0; y < CL_Display::get_height(); y += background.get_height())
- {
- for(int x=0; x < CL_Display::get_width(); x += background.get_width())
- background.draw(x, y);
- }
- }
-
- if (title_name != "-")
- {
- title->print_center(x_center, y_pos, title_name.c_str());
- y_pos += 50;
- }
-
- if (surface)
- {
- x_pos -= surface.get_width() / 2;
- surface.draw(x_pos, y_pos);
-
- y_pos += surface.get_height() + 20;
- }
-
- y_pos += 15;
- if (has_description)
- {
- CL_Display::fill_rect(x_center - (description.get_width()/2) - 15,
- y_pos - 15,
- x_center + (description.get_width()/2) + 15,
- y_pos + description.get_height() + 15,
- 0.0, 0.0, 0.0, 0.5);
-
- description.print_center(x_center, y_pos);
- }
-
- y_pos += description.get_height() + 15 + 20;
- int j = 0;
-
- level_start_y_pos = y_pos;
-
- for(std::vector<std::string>::iterator i = levelnames.begin(); i !=
levelnames.end(); ++i)
- {
- if (j > accessible_levels)
- {
- // Level is not yet accessible
- font.print_center(x_center, y_pos, (*i).c_str());
- CL_Display::fill_rect(x_center - font.get_text_width(i->c_str())/2 -
1,
- y_pos - 1,
- x_center + font.get_text_width(i->c_str())/2 +
1,
- y_pos + font.get_height() + 1,
- 0.0, 0.0, 0.0, 0.5);
- }
- else if (j == current_level)
- {
- // Level is accessible
- CL_Display::fill_rect(x_center - font.get_text_width(i->c_str())/2 -
1,
- y_pos - 1,
- x_center + font.get_text_width(i->c_str())/2 +
1,
- y_pos + font.get_height() + 1,
- 0.0f, 0.0f, 0.0f, 1.0f);
- CL_Display::draw_rect(x_center - font.get_text_width(i->c_str())/2 -
1,
- y_pos - 1,
- x_center + font.get_text_width(i->c_str())/2 +
1,
- y_pos + font.get_height() + 1,
- 1.0f, 1.0f, 1.0f, 1.0f);
- font.print_center(x_center, y_pos, (*i).c_str());
- }
- else
- {
- font.print_center(x_center, y_pos, (*i).c_str());
- }
- ++j;
- y_pos += font.get_height() + 4;
- }
-#endif
-}
-
-void
-Theme::load_status(std::string name)
-{
- status_file = System::basename(name);
- std::string rawname = status_file.substr(0, status_file.rfind("."));
-
- if (verbose > 1) std::cout << "Filename: " << status_file << std::endl;
- if (verbose > 1) std::cout << "Rawfile: " << status_file.substr(0,
status_file.rfind(".")) << std::endl;
-
- status_file = System::get_statdir() + "savegames/" + rawname + ".pst";
-
- if (verbose > 1) std::cout << "Filename to open: " << status_file <<
std::endl;
-
- if (System::exist(status_file))
- {
- std::ifstream in;
- in.open(status_file.c_str());
- in >> accessible_levels;
- in.close();
- }
- else
- {
- if (verbose) std::cout << "Theme: No Savegame for this theme found" <<
std::endl;
- accessible_levels = 0;
- }
-
- if ((unsigned int)(accessible_levels) >= level_filenames.size())
- {
- if (verbose) std::cout << "Warning: Accessible_Level is to high! " <<
accessible_levels << std::endl;
- accessible_levels = static_cast<int>(level_filenames.size()) - 1;
- }
- current_level = accessible_levels;
-}
-
-void
-Theme::play()
-{
- preload ();
-
- try
- {
- assert (!"Theme::play unimplemented");
-
- ScreenManager::instance()->push_screen
- (new
PingusGameSession(PLFResMgr::load_plf(plt.get_levels()[current_level]), true),
- true);
-
- if (current_level == accessible_levels)
- ++accessible_levels;
-
- if ((unsigned int)(accessible_levels) >= level_filenames.size())
- accessible_levels = static_cast<int>(level_filenames.size()) - 1;
-
- std::ofstream out (status_file.c_str());
- out << accessible_levels;
- out.close();
- }
-
- catch (PingusError& err)
- {
- std::cout << "Pingus_Error: " << err.get_message () << std::endl;
- }
-
- // Wait for escape release
- while (CL_Keyboard::get_keycode (CL_KEY_ESCAPE))
- CL_System::keep_alive ();
-}
-
-void
-Theme::next_level()
-{
- preload ();
-
- ++current_level;
-
- if ((unsigned int)(current_level) >= level_filenames.size())
- current_level = static_cast<int>(level_filenames.size()) - 1;
-
- if (current_level > accessible_levels)
- current_level = accessible_levels;
-
- //std::cout << "Level: " << current_level << std::endl;
-}
-
-void
-Theme::previous_level()
-{
- preload ();
-
- current_level--;
-
- if (current_level < 0)
- current_level = 0;
-
- // std::cout << "Level: " << current_level << std::endl;
-}
-
-void
-Theme::load_levels()
-{
- std::string filename;
-
- if (verbose)
- std::cout << "Theme opening levels... " << std::flush;
-
- for(std::vector<std::string>::iterator i = level_filenames.begin();
- i != level_filenames.end(); ++i)
- {
- filename = path_manager.complete("levels/" + *i);
-
- try
- {
- XMLPingusLevel plf(filename, filename);
- levelnames.push_back(_(plf.get_levelname()));
- }
- catch (PingusError& err)
- {
- std::cout << "Theme: PingusError: " << err.get_message () <<
std::endl;
- }
- }
- if (verbose)
- std::cout << "done." << std::endl;
-
- std::cout << "Levelnames: " << static_cast<unsigned>(levelnames.size()) <<
std::endl;
-}
-
-void
-Theme::preload ()
-{
- if (!is_loaded)
- {
- load(filename);
- is_loaded = true;
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/theme.hpp (from rev 2685,
branches/pingus_sdl/src/theme.hxx)
Deleted: branches/pingus_sdl/src/theme.hxx
===================================================================
--- branches/pingus_sdl/src/theme.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/theme.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,93 +0,0 @@
-// $Id: theme.hxx,v 1.9 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_THEME_HXX
-#define HEADER_PINGUS_THEME_HXX
-
-#include <ClanLib/Display/surface.h>
-#include "multiline_text.hxx"
-#include "plt_xml.hxx"
-
-class CL_Font;
-
-
-class Theme
-{
-private:
- PLTXML plt;
- CL_Surface surface;
- CL_Surface background;
- CL_Font font;
- CL_Font title;
-
- /** The last level, which is accessible */
- int accessible_levels;
-
- /** The currently selected level, valid in the interval [0,
- accessible_levels */
- int current_level;
- std::string filename;
-
- /** The name of the levels, this is was is displayed */
- std::vector<std::string> levelnames;
-
- /** The filenames of the levels */
- std::vector<std::string> level_filenames;
-
- std::string title_name;
- std::string status_file;
-
- /** This is the position at which the levelnames are printed, it is
- used to calculate mark_level_at_point() */
- int level_start_y_pos;
-
- bool has_description;
- MultiLineText description;
-
- bool is_loaded;
-
- void load_status(std::string);
- void load_levels();
-
-public:
- Theme (const std::string& filename);
- ~Theme ();
-
- void preload ();
-
- /** Marks the level, which is under the given coordinates
- @param x X-Position (normaly CL_Mouse::get_x())
- @param y Y-Position (normaly CL_Mouse::get_y()) */
- int mark_level_at_point (int x, int y);
- void next_level ();
- void previous_level ();
- void load (const std::string& filename);
- void draw_title ();
- void play ();
-
-private:
- Theme (const Theme&);
- Theme& operator= (const Theme&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/theme_selector.cpp (from rev 2685,
branches/pingus_sdl/src/theme_selector.cxx)
Deleted: branches/pingus_sdl/src/theme_selector.cxx
===================================================================
--- branches/pingus_sdl/src/theme_selector.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/theme_selector.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,373 +0,0 @@
-// $Id: theme_selector.cxx,v 1.17 2003/10/22 11:11:22 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <config.h>
-
-#include <iostream>
-#include <ClanLib/Display/display.h>
-#include <ClanLib/Display/font.h>
-#include <ClanLib/Display/keyboard.h>
-#include <ClanLib/Display/mouse.h>
-#include <ClanLib/Core/System/system.h>
-
-#include "gui/display.hxx"
-#include "globals.hxx"
-#include "theme_selector.hxx"
-#include "pingus_error.hxx"
-#include "resource.hxx"
-#include "sound/sound.hxx"
-#include "path_manager.hxx"
-#include "system.hxx"
-#include "fonts.hxx"
-#include "theme.hxx"
-
-
-ListBox::ListBox ()
-{
-}
-
-void
-ListBox::draw_offset(int x, int y)
-{
- int i = 0;
- CL_Display::fill_rect(CL_Rect(x, y, x + 200, CL_Display::get_height() - 20),
- Display::to_color(0.0, 0.0, 0.0, 0.5));
- for(ListIter item = items.begin(); item != items.end(); ++item) {
- item->draw_offset(x, y + (i++ * 20)); // FIXME i++ is a bit ambigious here
- }
-}
-
-void
-ListBox::add_item(std::string l)
-{
- items.push_back(ListItem(l));
-}
-
-// ---=== List item ===---
-
-ListItem::ListItem(std::string l)
-{
- label = l;
- font = Fonts::smallfont_h;
-}
-
-ListItem::ListItem (const ListItem& old)
- : label(old.label),
- font(old.font)
-{
-}
-
-ListItem&
-ListItem::operator= (const ListItem& old)
-{
- if (this == &old)
- return *this;
-
- label = old.label;
- font = new CL_Font(*(old.font));
-
- return *this;
-}
-
-void
-ListItem::draw_offset(int x, int y)
-{
- font->print_left(x, y, label.c_str());
-}
-
-// ---=== ThemeSelector ===---
-
-void
-ThemeSelector::Event::on_button_release(const CL_InputEvent& event)
-{
- if (!enabled) return;
-}
-
-void
-ThemeSelector::Event::on_button_press(const CL_InputEvent& event)
-{
- if (!enabled) return;
-
- if (device == CL_Input::keyboards[0])
- {
- switch (key.id)
- {
- case CL_KEY_ESCAPE:
- theme_selector->finished = true;
- break;
- case CL_KEY_LEFT:
- theme_selector->current_theme++;
- if (theme_selector->current_theme == theme_selector->themes.end())
- theme_selector->current_theme = theme_selector->themes.begin();
- break;
-
- case CL_KEY_RIGHT:
- if (theme_selector->current_theme == theme_selector->themes.begin())
- theme_selector->current_theme = theme_selector->themes.end();
- theme_selector->current_theme--;
- break;
-
- case CL_KEY_DOWN:
- (*(theme_selector->current_theme))->next_level();
- break;
- case CL_KEY_UP:
- (*(theme_selector->current_theme))->previous_level();
- break;
-
- case CL_KEY_ENTER:
- enabled = false;
- loading_screen.draw();
- (*(theme_selector->current_theme))->play();
- enabled = true;
- PingusSound::play_music("pingus-1.it");
- break;
- }
- }
- else if (device == CL_Input::pointers[0])
- {
- int tmp_level;
- switch (key.id)
- {
- case CL_MOUSE_LEFTBUTTON: // Left mouse button
- tmp_level = theme_selector->mark_level_at_point(int(key.x),
int(key.y));
- if (tmp_level != -1)
- {
- // We clicked on a level, start it now.
- enabled = false;
- loading_screen.draw();
- (*(theme_selector->current_theme))->play();
- enabled = true;
- }
- else
- {
- // Check if we clicked on one of the red buttons
- if (key.x > 0 && key.x < theme_selector->left_arrow.get_width()
- && key.y > (CL_Display::get_height() -
theme_selector->left_arrow.get_height()) / 2
- && key.y < (CL_Display::get_height() +
theme_selector->left_arrow.get_height()) / 2)
- {
- theme_selector->current_theme++;
- if (theme_selector->current_theme ==
theme_selector->themes.end())
- theme_selector->current_theme =
theme_selector->themes.begin();
- }
- else if (key.x > CL_Display::get_width() -
theme_selector->right_arrow.get_width()
- && key.x < CL_Display::get_width()
- && key.y > (CL_Display::get_height() -
theme_selector->right_arrow.get_height()) / 2
- && key.y < (CL_Display::get_height() +
theme_selector->right_arrow.get_height()) / 2)
- {
- if (theme_selector->current_theme ==
theme_selector->themes.begin())
- theme_selector->current_theme =
theme_selector->themes.end();
- theme_selector->current_theme--;
- }
- else if (key.x < theme_selector->back.get_width()
- && key.y < theme_selector->back.get_height())
- {
- theme_selector->finished = true;
- }
- }
- break;
- case CL_MOUSE_MIDDLEBUTTON: // Middle mouse
- theme_selector->finished = true;
- break;
- default:
- break;
- }
- }
-
- theme_selector->draw();
-
- return;
-}
-
-void
-ThemeSelector::Event::on_mouse_move(CL_InputDevice *, int mouse_x, int mouse_y)
-{
- //std::cout << "Event: on_mouse_move called.." << std::endl;
- if (!enabled) return;
- //std::cout << "Event: on_mouse_move active.." << std::endl;
- theme_selector->mark_level_at_point(mouse_x, mouse_y);
-}
-
-ThemeSelector::ThemeSelector()
-{
- dir_read = false;
- title_font = Fonts::pingus_large;
- theme_font = Fonts::pingus_small;
-
- left_arrow = Resource::load_surface("Hotspots/left_arrow", "global");
- right_arrow = Resource::load_surface("Hotspots/right_arrow", "global");
- back = Resource::load_surface("buttons/back", "core");
-
- event = new ThemeSelector::Event;
- event->enabled = false;
-
- event->theme_selector = this;
-
- //CL_Input::chain_button_press.push_back(event);
- //CL_Input::chain_button_release.push_back(event);
- //CL_Input::chain_mouse_move.push_back(event);
-
- current_theme = themes.end();
-
- ////on_button_press_slot = CL_Input::sig_button_press ().connect (event,
&ThemeSelector::Event::on_button_press);
- ////on_button_release_slot = CL_Input::sig_button_release ().connect (event,
&ThemeSelector::Event::on_button_release);
- ////on_mouse_move_slot = CL_Input::sig_mouse_move ().connect (event,
&ThemeSelector::Event::on_mouse_move);
-}
-
-ThemeSelector::~ThemeSelector()
-{
- // FIXME: Deleting the stuff which was allocated in readdir()
- // FIXME: Should be rewritten
- for(std::vector<Theme*>::iterator i = themes.begin(); i != themes.end(); ++i)
- delete (*i);
-
- // CL_Input::chain_mouse_move.remove(event);
- // CL_Input::chain_button_press.remove(event);
- // CL_Input::chain_button_release.remove(event);
-
- ////CL_Input::sig_button_press ().disconnect (on_button_press_slot);
- ////CL_Input::sig_button_release ().disconnect (on_button_release_slot);
- ////CL_Input::sig_mouse_move ().disconnect (on_mouse_move_slot);
-
- delete event;
-}
-
-void
-ThemeSelector::display()
-{
- event->enabled = true;
-
- while(CL_Mouse::left_pressed() || CL_Mouse::middle_pressed())
- CL_System::keep_alive();
-
- if (!dir_read)
- {
- loading_screen.draw();
-
- readdir(path_manager.complete("themes/"));
-
- dir_read = true;
- }
- current_theme = themes.end()-1;
-
- PingusSound::play_music("pingus-1.it");
-
- finished = false;
- while(!finished)
- {
- CL_System::keep_alive();
- draw();
- CL_System::sleep (20);
- }
-
- while (CL_Keyboard::get_keycode(CL_KEY_ESCAPE))
- CL_System::keep_alive ();
-
- event->enabled = false;
-}
-
-void
-ThemeSelector::draw()
-{
- //CL_Display::fill_rect(0,0,640,480,0.5,0.0,0.0,0.5);
-
- (*current_theme)->draw_title();
-
- {
- int item_width = (CL_Display::get_width() / themes.size());
- int item_index = themes.size() - std::distance(themes.begin(),
current_theme) - 1;
-
- Display::draw_rect(item_index * item_width, CL_Display::get_height() - 15,
- (item_index + 1) * item_width, CL_Display::get_height(),
- 0.0, 1.0, 0.0, 1.0);
- }
-
- left_arrow.draw(0, (CL_Display::get_height() - left_arrow.get_height()) / 2);
- right_arrow.draw(CL_Display::get_width() - right_arrow.get_width(),
- (CL_Display::get_height() - right_arrow.get_height())
/ 2);
- back.draw(0, 0);
- if (CL_Mouse::get_x() < (int)back.get_width()
- && CL_Mouse::get_y() < (int)back.get_height())
- CL_Display::fill_rect(0, 0, back.get_width(), back.get_height(),
- 1.0f, 1.0f, 1.0f, 0.3f);
-
- theme_font->print_center(CL_Display::get_width()/2, CL_Display::get_height()
- 50,
- "..:: Use the cursor keys to select a level ::..");
-
- Display::flip_display();
-}
-
-void
-ThemeSelector::readdir(std::string path)
-{
- System::Directory dir;
- std::string pathname;
- std::string::size_type pos = 0;
- std::string::size_type last_pos = 0;
- bool exit_for = false;
-
- // Remove this and pingus_datadir should become a vector
- for(pos = path.find(":", last_pos);
- !exit_for;
- last_pos = pos + 1, pos = path.find(":", last_pos))
- {
- if (pos == std::string::npos)
- {
- pathname = path.substr(last_pos, std::string::npos);
- exit_for = true;
- }
- else
- {
- pathname = path.substr(last_pos, pos - last_pos);
- }
-
- std::cout << "ThemeSelector: " << pathname << std::endl;
- dir = System::opendir(pathname, "*.xml");
-
- for(System::Directory::iterator entry = dir.begin(); entry != dir.end();
++entry)
- {
- if (verbose) std::cout << "ThemeSelelector: Name of entry: " <<
pathname + entry->name << std::endl;
- try {
- themes.push_back(new Theme(pathname + entry->name));
- } catch (PingusError& err) {
- std::cout << "ThemeSelector: PingusError: " << err.get_message ()
<< std::endl;
- }
- }
- }
-
- if (themes.size() == 0)
- {
- PingusError::raise ("ThemeSelector: Couldn't find any themes");
- }
- else
- {
- std::cout << "ThemesSelector: " << themes.size() << " Themes loaded." <<
std::endl;
- }
-}
-
-int
-ThemeSelector::mark_level_at_point(int x, int y)
-{
- if (current_theme == themes.end())
- return 0;
- else
- return (*current_theme)->mark_level_at_point(x, y);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/theme_selector.hpp (from rev 2685,
branches/pingus_sdl/src/theme_selector.hxx)
Deleted: branches/pingus_sdl/src/theme_selector.hxx
===================================================================
--- branches/pingus_sdl/src/theme_selector.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/theme_selector.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,144 +0,0 @@
-// $Id: theme_selector.hxx,v 1.10 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_THEME_SELECTOR_HXX
-#define HEADER_PINGUS_THEME_SELECTOR_HXX
-
-#include "pingus.hxx"
-#include <vector>
-#include <string>
-
-class CL_Key;
-class Font;
-class CL_InputDevice;
-
-
-class Theme;
-class AlphaButton;
-
-class ListItem
-{
-private:
- std::string label;
- Font font;
-
-public:
- ListItem(std::string);
- void draw_offset(int x, int y);
- bool mouse_over();
-
- ListItem (const ListItem& old);
- ListItem& operator= (const ListItem& old);
-};
-
-class ListBox
-{
-private:
- std::vector<ListItem> items;
- typedef std::vector<ListItem>::iterator ListIter;
-public:
- ListBox();
- void add_item(std::string);
- void draw_offset(int x, int y);
-
-private:
- ListBox (const ListBox&);
- ListBox& operator= (const ListBox&);
-};
-
-class ThemeSelector
-{
-public:
- ////CL_Slot on_button_press_slot;
- ////CL_Slot on_button_release_slot;
- ////CL_Slot on_mouse_move_slot;
-
- class Event /*: public CL_Event_ButtonPress,
- public CL_Event_ButtonRelease,
- public CL_Event_MouseMove*/
- {
- public:
- bool enabled;
- ThemeSelector* theme_selector;
-
- public:
- Event () { }
- virtual ~Event () { }
-
- virtual void on_button_press(const CL_InputEvent& event);
- virtual void on_button_release(const CL_InputEvent& event);
- virtual void on_mouse_move(const CL_InputEvent& event);
-
- private:
- Event (const Event&);
- Event& operator= (const Event&);
- };
-
- friend class Event;
-
- Event* event;
-
-private:
- std::vector<Theme*> themes;
- std::vector<Theme*>::iterator current_theme;
-
- /** A large font, used for the Title Name */
- Font title_font;
-
- /** This font is used for the levelnames */
- Font theme_font;
-
- /// The red arrow to the right
- CL_Surface right_arrow;
- /// The red arrow to the left
- CL_Surface left_arrow;
- /// The back button
- CL_Surface back;
-
- bool dir_read;
- bool finished;
- ListBox list_box;
-
- void draw();
- bool key_pressed(int key);
-
- /** Marks the level, which is under the given coordinates
- @param x X-Position (normaly CL_Mouse::get_x())
- @param y Y-Position (normaly CL_Mouse::get_y())
- @return The current_level at point or -1 if no level is under point */
- int mark_level_at_point(int x, int y);
-
- void readdir(std::string path);
-
-public:
- ThemeSelector();
- ~ThemeSelector();
-
- /** Display the theme selector */
- void display ();
-
-private:
- ThemeSelector (const ThemeSelector&);
- ThemeSelector& operator= (const ThemeSelector&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/timer.cpp (from rev 2685,
branches/pingus_sdl/src/timer.cxx)
Deleted: branches/pingus_sdl/src/timer.cxx
===================================================================
--- branches/pingus_sdl/src/timer.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/timer.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,42 +0,0 @@
-// $Id: timer.cxx,v 1.6 2003/10/20 13:33:43 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "SDL.h"
-#include "debug.hxx"
-#include "globals.hxx"
-#include "timer.hxx"
-
-
-Timer::Timer(const char* desc)
- : description(desc),
- start_time(SDL_GetTicks())
-{
-}
-
-void
-Timer::stop()
-{
- unsigned int time = SDL_GetTicks() - start_time;
- pout(PINGUS_DEBUG_LOADING)
- << "Timer: '" << description << "' took "
- << time << "msec" << std::endl;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/timer.hpp (from rev 2685,
branches/pingus_sdl/src/timer.hxx)
Deleted: branches/pingus_sdl/src/timer.hxx
===================================================================
--- branches/pingus_sdl/src/timer.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/timer.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,50 +0,0 @@
-// $Id: timer.hxx,v 1.8 2003/10/20 13:33:43 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_TIMER_HXX
-#define HEADER_PINGUS_TIMER_HXX
-
-#include "pingus.hxx"
-
-
-/** A simple class for benchmark purpose. It lets you start and stop a
- timer and recieve the time passed.*/
-class Timer
-{
-private:
- const char* description;
- unsigned int start_time;
-
-public:
- /** Init a timer with a description and start it */
- Timer(const char* desc);
-
- /** Stop the timer
- @return The time passed since the last start() */
- void stop();
-
-private:
- Timer (const Timer&);
- Timer& operator= (const Timer&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/tinygettext/tinygettext.cpp (from rev 2685,
branches/pingus_sdl/src/tinygettext/tinygettext.cxx)
Deleted: branches/pingus_sdl/src/tinygettext/tinygettext.cxx
===================================================================
--- branches/pingus_sdl/src/tinygettext/tinygettext.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/tinygettext/tinygettext.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,792 +0,0 @@
-// $Id: tinygettext.cpp,v 1.4 2004/11/25 13:15:56 matzebraun Exp $
-//
-// TinyGetText - A small flexible gettext() replacement
-// Copyright (C) 2004 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <config.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#else
-#include "../win32/uce_dirent.h"
-#endif
-
-#include <sys/types.h>
-#include <iconv.h>
-#include <fstream>
-#include <iostream>
-#include <ctype.h>
-#include <errno.h>
-#include "tinygettext.hxx"
-
-//#define TRANSLATION_DEBUG
-
-namespace TinyGetText {
-
-class charconv
-{
-public:
- charconv() : m_conv(0)
- {}
-
- charconv(const std::string& incharset, const std::string& outcharset)
- : m_conv(0)
- {
- create(incharset, outcharset);
- }
-
- ~charconv()
- {
- close();
- }
-
- void create(const std::string& incharset, const std::string& outcharset)
- {
- // Create the converter.
- if(!(m_conv = iconv_open(incharset.c_str(),
outcharset.c_str())))
- {
- /*if(errno == EINVAL)
- {
- ostringstream sstr;
- sstr << "Unsupported conversion: " << incharset
- << " => " << outcharset << "!";
- throw runtime_error(sstr.str());
- }
- else
- throw runtime_error(strerror(errno));
- */
- exit(1);
- }
- }
-
- void close()
- {
- // Free, if exists.
- if(m_conv)
- {
- iconv_close(m_conv);
- m_conv = 0;
- }
- }
-
- /// Convert a string from encoding to another.
- std::string convert(std::string text)
- {
- if(!m_conv) return text;
-
- size_t in_size = text.size();
- size_t out_size = 4*in_size; // Worst case scenario: ASCII ->
UTF-32?
- std::string result(out_size, ' ');
- ICONV_CONST char* in_str = &text[0];
- char* out_str = &result[0];
-
- // Try to convert the text.
- if(iconv(m_conv, &in_str, &in_size, &out_str, &out_size) != 0)
- //PingusError::raise("Error while converting: " +
strerror(errno));
- exit(1);
- // Eat off the spare space.
- result.resize(out_str - &result[0]);
- return result;
- }
-protected:
- iconv_t m_conv;
-};
-
-
-/** Convert \a which is in \a from_charset to \a to_charset and return it */
-std::string convert(const std::string& text,
- const std::string& from_charset,
- const std::string& to_charset)
-{
- if (from_charset == to_charset)
- return text;
-
- charconv *cc = new charconv(from_charset, to_charset);
- std::string ret = cc->convert(text);
- cc->close();
- return ret;
-}
-/*
- iconv_t cd = iconv_open(to_charset.c_str(), from_charset.c_str());
-
- size_t in_len = text.length();
- size_t out_len = text.length()*4; // Should be large enough to hold UTF-32
-
- char* out_orig = new char[out_len]; // FIXME: cross fingers that this is
enough
- char* in_orig = new char[in_len+1];
- strcpy(in_orig, text.c_str());
-
- char* out = out_orig;
- const char* in = in_orig;
-
- //std::cout << "IN: " << (int)in << " " << in_len << " " << (int)out << " "
<< out_len << std::endl;
- int retval = iconv(cd, &in, &in_len, &out, &out_len);
- //std::cout << "OUT: " << (int)in << " " << in_len << " " << (int)out << " "
<< out_len << std::endl;
-
- if (retval != 0)
- {
- std::cerr << strerror(errno) << std::endl;
- std::cerr << "Error: conversion from " << from_charset
- << " to " << to_charset << " went wrong: " << retval <<
std::endl;
- }
- iconv_close(cd);
-
-
- <dolphin> your code is also buggy
-<dolphin> there will be extra spaces at the end of the string
-<dolphin> the lenght of the final string should be: out_str - out_orig
-<dolphin> or: out_size_before_iconv_call - out_size_after_iconv_call
-
- std::string ret(out_orig, out_len);
- delete[] out_orig;
- delete[] in_orig;
- return ret;
-}
-*/
-
-bool has_suffix(const std::string& lhs, const std::string rhs)
-{
- if (lhs.length() < rhs.length())
- return false;
- else
- return lhs.compare(lhs.length() - rhs.length(), rhs.length(), rhs) == 0;
-}
-
-bool has_prefix(const std::string& lhs, const std::string rhs)
-{
- if (lhs.length() < rhs.length())
- return false;
- else
- return lhs.compare(0, rhs.length(), rhs) == 0;
-}
-
-int plural1(int ) { return 0; }
-int plural2_1(int n) { return (n != 1); }
-int plural2_2(int n) { return (n > 1); }
-int plural3_lv(int n) { return (n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2); }
-int plural3_ga(int n) { return n==1 ? 0 : n==2 ? 1 : 2; }
-int plural3_lt(int n) { return (n%10==1 && n%100!=11 ? 0 : n%10>=2 &&
(n%100<10 || n%100>=20) ? 1 : 2); }
-int plural3_1(int n) { return (n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4
&& (n%100<10 || n%100>=20) ? 1 : 2); }
-int plural3_sk(int n) { return (n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2; }
-int plural3_pl(int n) { return (n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 ||
n%100>=20) ? 1 : 2); }
-int plural3_sl(int n) { return (n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 ||
n%100==4 ? 2 : 3); }
-
-/** Language Definitions */
-//*{
-LanguageDef lang_hu("hu", "Hungarian", 1, plural1); // "nplurals=1;
plural=0;"
-LanguageDef lang_ja("ja", "Japanese", 1, plural1); // "nplurals=1;
plural=0;"
-LanguageDef lang_ko("ko", "Korean", 1, plural1); // "nplurals=1;
plural=0;"
-LanguageDef lang_tr("tr", "Turkish", 1, plural1); // "nplurals=1;
plural=0;"
-LanguageDef lang_da("da", "Danish", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_nl("nl", "Dutch", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_en("en", "English", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_fo("fo", "Faroese", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_de("de", "German", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_nb("nb", "Norwegian Bokmal", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_no("no", "Norwegian", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_nn("nn", "Norwegian Nynorsk", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_sv("sv", "Swedish", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_et("et", "Estonian", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_fi("fi", "Finnish", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_el("el", "Greek", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_he("he", "Hebrew", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_it("it", "Italian", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_pt("pt", "Portuguese", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_es("es", "Spanish", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_eo("eo", "Esperanto", 2, plural2_1); // "nplurals=2;
plural=(n != 1);"
-LanguageDef lang_fr("fr", "French", 2, plural2_2); // "nplurals=2;
plural=(n > 1);"
-LanguageDef lang_pt_BR("pt_BR", "Brazilian", 2, plural2_2); // "nplurals=2;
plural=(n > 1);"
-LanguageDef lang_lv("lv", "Latvian", 3, plural3_lv); // "nplurals=3;
plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);"
-LanguageDef lang_ga("ga", "Irish", 3, plural3_ga); // "nplurals=3;
plural=n==1 ? 0 : n==2 ? 1 : 2;"
-LanguageDef lang_lt("lt", "Lithuanian", 3, plural3_lt); // "nplurals=3;
plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);"
-LanguageDef lang_hr("hr", "Croatian", 3, plural3_1); // "nplurals=3;
plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 ||
n%100>=20) ? 1 : 2);"
-LanguageDef lang_cs("cs", "Czech", 3, plural3_1); // "nplurals=3;
plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 ||
n%100>=20) ? 1 : 2);"
-LanguageDef lang_ru("ru", "Russian", 3, plural3_1); // "nplurals=3;
plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 ||
n%100>=20) ? 1 : 2);"
-LanguageDef lang_uk("uk", "Ukrainian", 3, plural3_1); // "nplurals=3;
plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 ||
n%100>=20) ? 1 : 2);"
-LanguageDef lang_sk("sk", "Slovak", 3, plural3_sk); // "nplurals=3;
plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"
-LanguageDef lang_pl("pl", "Polish", 3, plural3_pl); // "nplurals=3;
plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);
-LanguageDef lang_sl("sl", "Slovenian", 3, plural3_sl); // "nplurals=4;
plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);"
-//*}
-
-LanguageDef&
-get_language_def(const std::string& name)
-{
- if (name == "hu") return lang_hu;
- else if (name == "ja") return lang_ja;
- else if (name == "ko") return lang_ko;
- else if (name == "tr") return lang_tr;
- else if (name == "da") return lang_da;
- else if (name == "nl") return lang_nl;
- else if (name == "en") return lang_en;
- else if (name == "fo") return lang_fo;
- else if (name == "de") return lang_de;
- else if (name == "nb") return lang_nb;
- else if (name == "no") return lang_no;
- else if (name == "nn") return lang_nn;
- else if (name == "sv") return lang_sv;
- else if (name == "et") return lang_et;
- else if (name == "fi") return lang_fi;
- else if (name == "el") return lang_el;
- else if (name == "he") return lang_he;
- else if (name == "it") return lang_it;
- else if (name == "pt") return lang_pt;
- else if (name == "es") return lang_es;
- else if (name == "eo") return lang_eo;
- else if (name == "fr") return lang_fr;
- else if (name == "pt_BR") return lang_pt_BR;
- else if (name == "lv") return lang_lv;
- else if (name == "ga") return lang_ga;
- else if (name == "lt") return lang_lt;
- else if (name == "hr") return lang_hr;
- else if (name == "cs") return lang_cs;
- else if (name == "ru") return lang_ru;
- else if (name == "uk") return lang_uk;
- else if (name == "sk") return lang_sk;
- else if (name == "pl") return lang_pl;
- else if (name == "sl") return lang_sl;
- else return lang_en;
-}
-
-DictionaryManager::DictionaryManager()
- : current_dict(&empty_dict)
-{
- parseLocaleAliases();
- // setup language from environment vars
- const char* lang = getenv("LC_ALL");
- if(!lang)
- lang = getenv("LC_MESSAGES");
- if(!lang)
- lang = getenv("LANG");
-
- if(lang)
- set_language(lang);
-}
-
-void
-DictionaryManager::parseLocaleAliases()
-{
- // try to parse language alias list
- std::ifstream in("/usr/share/locale/locale.alias");
-
- char c = ' ';
- while(in.good() && !in.eof()) {
- while(isspace(c) && !in.eof())
- in.get(c);
-
- if(c == '#') { // skip comments
- while(c != '\n' && !in.eof())
- in.get(c);
- continue;
- }
-
- std::string alias;
- while(!isspace(c) && !in.eof()) {
- alias += c;
- in.get(c);
- }
- while(isspace(c) && !in.eof())
- in.get(c);
- std::string language;
- while(!isspace(c) && !in.eof()) {
- language += c;
- in.get(c);
- }
-
- if(in.eof())
- break;
- set_language_alias(alias, language);
- }
-}
-
-Dictionary&
-DictionaryManager::get_dictionary(const std::string& spec)
-{
- std::string lang = get_language_from_spec(spec);
- Dictionaries::iterator i = dictionaries.find(get_language_from_spec(lang));
- if (i != dictionaries.end())
- {
- return i->second;
- }
- else // Dictionary for languages lang isn't loaded, so we load it
- {
- //std::cout << "get_dictionary: " << lang << std::endl;
- Dictionary& dict = dictionaries[lang];
-
- dict.set_language(get_language_def(lang));
- if(charset != "")
- dict.set_charset(charset);
-
- for (SearchPath::iterator p = search_path.begin(); p !=
search_path.end(); ++p)
- {
- DIR* dir = opendir(p->c_str());
- if (!dir)
- {
- std::cerr << "TinyGetText: Error: opendir() failed on " << *p <<
std::endl;
- }
- else
- {
- struct dirent* ent;
- while((ent = readdir(dir)))
- {
- if (std::string(ent->d_name) == lang + ".po")
- {
- std::string pofile = *p + "/" + ent->d_name;
- std::ifstream in(pofile.c_str());
- if (!in)
- {
- std::cerr << "Error: Failure file opening: " <<
pofile << std::endl;
- }
- else
- {
- read_po_file(dict, in);
- }
- }
- }
- closedir(dir);
- }
- }
-
- return dict;
- }
-}
-
-std::set<std::string>
-DictionaryManager::get_languages()
-{
- std::set<std::string> languages;
-
- for (SearchPath::iterator p = search_path.begin(); p != search_path.end();
++p)
- {
- DIR* dir = opendir(p->c_str());
- if (!dir)
- {
- std::cerr << "Error: opendir() failed on " << *p << std::endl;
- }
- else
- {
- struct dirent* ent;
- while((ent = readdir(dir)))
- {
- if (has_suffix(ent->d_name, ".po"))
- {
- std::string filename = ent->d_name;
- languages.insert(filename.substr(0, filename.length()-3));
- }
- }
- closedir(dir);
- }
- }
- return languages;
-}
-
-void
-DictionaryManager::set_language(const std::string& lang)
-{
- language = get_language_from_spec(lang);
- current_dict = & (get_dictionary(language));
-}
-
-void
-DictionaryManager::set_charset(const std::string& charset)
-{
- dictionaries.clear(); // changing charset invalidates cache
- this->charset = charset;
- set_language(language);
-}
-
-void
-DictionaryManager::set_language_alias(const std::string& alias,
- const std::string& language)
-{
- language_aliases.insert(std::make_pair(alias, language));
-}
-
-std::string
-DictionaryManager::get_language_from_spec(const std::string& spec)
-{
- std::string lang = spec;
- Aliases::iterator i = language_aliases.find(lang);
- if(i != language_aliases.end()) {
- lang = i->second;
- }
-
- std::string::size_type s = lang.find_first_of("_.");
- if(s == std::string::npos)
- return lang;
-
- return std::string(lang, 0, s);
-}
-
-void
-DictionaryManager::add_directory(const std::string& pathname)
-{
- dictionaries.clear(); // adding directories invalidates cache
- search_path.push_back(pathname);
- set_language(language);
-}
-
-//---------------------------------------------------------------------------
-
-Dictionary::Dictionary(const LanguageDef& language_, const std::string&
charset_)
- : language(language_), charset(charset_)
-{
-}
-
-Dictionary::Dictionary()
- : language(lang_en)
-{
-}
-
-std::string
-Dictionary::get_charset() const
-{
- return charset;
-}
-
-void
-Dictionary::set_charset(const std::string& charset_)
-{
- charset = charset_;
-}
-
-void
-Dictionary::set_language(const LanguageDef& lang)
-{
- language = lang;
-}
-
-std::string
-Dictionary::translate(const std::string& msgid, const std::string& msgid2, int
num)
-{
- PluralEntries::iterator i = plural_entries.find(msgid);
- std::map<int, std::string>& msgstrs = i->second;
-
- if (i != plural_entries.end() && !msgstrs.empty())
- {
- int g = language.plural(num);
- std::map<int, std::string>::iterator j = msgstrs.find(g);
- if (j != msgstrs.end())
- {
- return j->second;
- }
- else
- {
- // Return the first translation, in case we can't translate the
specific number
- return msgstrs.begin()->second;
- }
- }
- else
- {
-#ifdef TRANSLATION_DEBUG
- std::cerr << "Warning: Couldn't translate: " << msgid << std::endl;
- std::cerr << "Candidates: " << std::endl;
- for (PluralEntries::iterator i = plural_entries.begin(); i !=
plural_entries.end(); ++i)
- std::cout << "'" << i->first << "'" << std::endl;
-#endif
-
- if (plural2_1(num)) // default to english rules
- return msgid2;
- else
- return msgid;
- }
-}
-
-std::string
-Dictionary::translate(const std::string& msgid)
-{
- Entries::iterator i = entries.find(msgid);
- if (i != entries.end() && !i->second.empty())
- {
- return i->second;
- }
- else
- {
-#ifdef TRANSLATION_DBEUG
- std::cout << "Error: Couldn't translate: " << msgid << std::endl;
-#endif
- return msgid;
- }
-}
-
-void
-Dictionary::add_translation(const std::string& msgid, const std::string& ,
- const std::map<int, std::string>& msgstrs)
-{
- // Do we need msgid2 for anything? its after all supplied to the
- // translate call, so we just throw it away
- plural_entries[msgid] = msgstrs;
-}
-
-void
-Dictionary::add_translation(const std::string& msgid, const std::string&
msgstr)
-{
- entries[msgid] = msgstr;
-}
-
-class POFileReader
-{
-private:
- struct Token
- {
- std::string keyword;
- std::string content;
- };
-
- Dictionary& dict;
-
- std::string from_charset;
- std::string to_charset;
-
- std::string current_msgid;
- std::string current_msgid_plural;
- std::map<int, std::string> msgstr_plural;
-
- int line_num;
-
- enum { WANT_MSGID, WANT_MSGSTR, WANT_MSGSTR_PLURAL, WANT_MSGID_PLURAL }
state;
-
-public:
- POFileReader(std::istream& in, Dictionary& dict_)
- : dict(dict_)
- {
- state = WANT_MSGID;
- line_num = 0;
- tokenize_po(in);
- }
-
- void parse_header(const std::string& header)
- {
- // Seperate the header in lines
- typedef std::vector<std::string> Lines;
- Lines lines;
-
- std::string::size_type start = 0;
- for(std::string::size_type i = 0; i < header.length(); ++i)
- {
- if (header[i] == '\n')
- {
- lines.push_back(header.substr(start, i - start));
- start = i+1;
- }
- }
-
- for(Lines::iterator i = lines.begin(); i != lines.end(); ++i)
- {
- if (has_prefix(*i, "Content-Type: text/plain; charset=")) {
- from_charset = i->substr(strlen("Content-Type: text/plain;
charset="));
- }
- }
-
- if (from_charset.empty() || from_charset == "CHARSET")
- {
- std::cerr << "Error: Charset not specified for .po, fallback to
ISO-8859-1" << std::endl;
- from_charset = "ISO-8859-1";
- }
-
- to_charset = dict.get_charset();
- if (to_charset.empty())
- { // No charset requested from the dict, so we use the one from the .po
- to_charset = from_charset;
- dict.set_charset(from_charset);
- }
- }
-
- void add_token(const Token& token)
- {
- switch(state)
- {
- case WANT_MSGID:
- if (token.keyword == "msgid")
- {
- current_msgid = token.content;
- state = WANT_MSGID_PLURAL;
- }
- else if (token.keyword.empty())
- {
- //std::cerr << "Got EOF, everything looks ok." << std::endl;
- }
- else
- {
- std::cerr << "tinygettext: expected 'msgid' keyword, got '" <<
token.keyword
- << "' at line " << line_num << std::endl;
- }
- break;
-
- case WANT_MSGID_PLURAL:
- if (token.keyword == "msgid_plural")
- {
- current_msgid_plural = token.content;
- state = WANT_MSGSTR_PLURAL;
- }
- else
- {
- state = WANT_MSGSTR;
- add_token(token);
- }
- break;
-
- case WANT_MSGSTR:
- if (token.keyword == "msgstr")
- {
- if (current_msgid == "")
- { // .po Header is hidden in the msgid with the empty string
- parse_header(token.content);
- }
- else
- {
- dict.add_translation(current_msgid, convert(token.content,
from_charset, to_charset));
- }
- state = WANT_MSGID;
- }
- else
- {
- std::cerr << "tinygettext: expected 'msgstr' keyword, got " <<
token.keyword
- << " at line " << line_num << std::endl;
- }
- break;
-
- case WANT_MSGSTR_PLURAL:
- if (has_prefix(token.keyword, "msgstr["))
- {
- int num;
- if (sscanf(token.keyword.c_str(), "msgstr[%d]", &num) != 1)
- {
- std::cerr << "Error: Couldn't parse: " << token.keyword <<
std::endl;
- }
- else
- {
- msgstr_plural[num] = convert(token.content, from_charset,
to_charset);
- }
- }
- else
- {
- dict.add_translation(current_msgid, current_msgid_plural,
msgstr_plural);
-
- state = WANT_MSGID;
- add_token(token);
- }
- break;
- }
- }
-
- inline int getchar(std::istream& in)
- {
- int c = in.get();
- if (c == '\n')
- line_num += 1;
- return c;
- }
-
- void tokenize_po(std::istream& in)
- {
- enum State { READ_KEYWORD,
- READ_CONTENT,
- READ_CONTENT_IN_STRING,
- SKIP_COMMENT };
-
- State state = READ_KEYWORD;
- int c;
- Token token;
-
- while((c = getchar(in)) != EOF)
- {
- //std::cout << "Lexing char: '" << char(c) << "' " << c << " state: "
<< state << std::endl;
- switch(state)
- {
- case READ_KEYWORD:
- if (c == '#')
- {
- state = SKIP_COMMENT;
- }
- else if (isspace(c))
- {
- state = READ_KEYWORD;
- }
- else
- {
- // Read a new token
- token = Token();
-
- do { // Read keyword
- token.keyword += c;
- } while((c = getchar(in)) != EOF && !isspace(c));
- in.unget();
-
- state = READ_CONTENT;
- }
- break;
-
- case READ_CONTENT:
- while((c = getchar(in)) != EOF)
- {
- if (c == '"') {
- // Found start of content
- state = READ_CONTENT_IN_STRING;
- break;
- } else if (isspace(c)) {
- // skip
- } else { // Read something that may be a keyword
- in.unget();
- state = READ_KEYWORD;
- add_token(token);
- break;
- }
- }
- break;
-
- case READ_CONTENT_IN_STRING:
- if (c == '\\') {
- c = getchar(in);
- if (c != EOF)
- {
- if (c == 'n') token.content += '\n';
- else if (c == 't') token.content += '\t';
- else if (c == 'r') token.content += '\r';
- else if (c == '"') token.content += '"';
- else
- {
- std::cout << "Unhandled escape character: " << char(c)
<< std::endl;
- }
- }
- else
- {
- std::cout << "Unterminated string" << std::endl;
- }
- } else if (c == '"') { // Content string is terminated
- state = READ_CONTENT;
- } else {
- token.content += c;
- }
- break;
-
- case SKIP_COMMENT:
- if (c == '\n')
- state = READ_KEYWORD;
- break;
- }
- }
- // add_token(token);
- }
-};
-
-void read_po_file(Dictionary& dict_, std::istream& in)
-{
- POFileReader reader(in, dict_);
-}
-
-} // namespace TinyGetText
-
-/* EOF */
Copied: branches/pingus_sdl/src/tinygettext/tinygettext.hpp (from rev 2685,
branches/pingus_sdl/src/tinygettext/tinygettext.hxx)
Deleted: branches/pingus_sdl/src/tinygettext/tinygettext.hxx
===================================================================
--- branches/pingus_sdl/src/tinygettext/tinygettext.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/tinygettext/tinygettext.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,154 +0,0 @@
-// $Id: tinygettext.h,v 1.2 2004/11/24 23:10:01 matzebraun Exp $
-//
-// TinyGetText - A small flexible gettext() replacement
-// Copyright (C) 2004 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_TINYGETTEXT_HXX
-#define HEADER_TINYGETTEXT_HXX
-
-#include <map>
-#include <vector>
-#include <set>
-#include <string>
-
-namespace TinyGetText {
-
-typedef int (*PluralFunc)(int n);
-
-struct LanguageDef {
- const char* code;
- const char* name;
- int nplural;
- PluralFunc plural;
-
- LanguageDef(const char* code_, const char* name_, int nplural_, PluralFunc
plural_)
- : code(code_), name(name_), nplural(nplural_), plural(plural_)
- {}
-};
-
-/** A simple dictionary class that mimics gettext() behaviour. Each
- Dictionary only works for a single language, for managing multiple
- languages and .po files at once use the DictionaryManager. */
-class Dictionary
-{
-private:
- typedef std::map<std::string, std::string> Entries;
- Entries entries;
-
- typedef std::map<std::string, std::map<int, std::string> > PluralEntries;
- PluralEntries plural_entries;
-
- LanguageDef language;
- std::string charset;
-public:
- /** */
- Dictionary(const LanguageDef& language_, const std::string& charset = "");
-
- Dictionary();
-
- /** Return the charset used for this dictionary */
- std::string get_charset() const;
-
- /** Set a charset for this dictionary, this will NOT convert stuff,
- it is for information only, you have to convert stuff yourself
- when you add it with \a add_translation() */
- void set_charset(const std::string& charset);
-
- /** Set the language that is used for this dictionary, this is
- mainly needed to evaluate plural forms */
- void set_language(const LanguageDef& lang);
-
- /** Translate the string \a msgid to its correct plural form, based
- on the number of items given by \a num. \a msgid2 is \a msgid in
- plural form. */
- std::string translate(const std::string& msgid, const std::string& msgid2,
int num);
-
- /** Translate the string \a msgid. */
- std::string translate(const std::string& msgid);
-
- /** Add a translation from \a msgid to \a msgstr to the dictionary,
- where \a msgid is the singular form of the message, msgid2 the
- plural form and msgstrs a table of translations. The right
- translation will be calculated based on the \a num argument to
- translate(). */
- void add_translation(const std::string& msgid, const std::string& msgid2,
- const std::map<int, std::string>& msgstrs);
-
- /** Add a translation from \a msgid to \a msgstr to the
- dictionary */
- void add_translation(const std::string& msgid, const std::string& msgstr);
-};
-
-/** Manager class for dictionaries, you give it a bunch of directories
- with .po files and it will then automatically load the right file
- on demand depending on which language was set. */
-class DictionaryManager
-{
-private:
- typedef std::map<std::string, Dictionary> Dictionaries;
- Dictionaries dictionaries;
- typedef std::vector<std::string> SearchPath;
- SearchPath search_path;
- typedef std::map<std::string, std::string> Aliases;
- Aliases language_aliases;
- std::string charset;
- std::string language;
- Dictionary* current_dict;
- Dictionary empty_dict;
-
-public:
- DictionaryManager();
-
- /** Return the currently active dictionary, if none is set, an empty
- dictionary is returned. */
- Dictionary& get_dictionary()
- { return *current_dict; }
-
- /** Get dictionary for lang */
- Dictionary& get_dictionary(const std::string& langspec);
-
- /** Set a language based on a four? letter country code */
- void set_language(const std::string& langspec);
-
- /** Set a charset that will be set on the returned dictionaries */
- void set_charset(const std::string& charset);
-
- /** Define an alias for a language */
- void set_language_alias(const std::string& alias, const std::string& lang);
-
- /** Add a directory to the search path for dictionaries */
- void add_directory(const std::string& pathname);
-
- /** Return a set of the available languages in their country code */
- std::set<std::string> get_languages();
-
-private:
- void parseLocaleAliases();
- /// returns the language part in a language spec (like de_DE.UTF-8 -> de)
- std::string get_language_from_spec(const std::string& spec);
-};
-
-/** Read the content of the .po file given as \a in into the
- dictionary given as \a dict */
-void read_po_file(Dictionary& dict, std::istream& in);
-LanguageDef& get_language_def(const std::string& name);
-
-} // namespace TinyGetText
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/true_server.cpp (from rev 2685,
branches/pingus_sdl/src/true_server.cxx)
Deleted: branches/pingus_sdl/src/true_server.cxx
===================================================================
--- branches/pingus_sdl/src/true_server.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/true_server.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,86 +0,0 @@
-// $Id: true_server.cxx,v 1.21 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "goal_manager.hxx"
-#include "true_server.hxx"
-
-
-TrueServer::TrueServer(const PingusLevel& arg_plf)
- : Server(arg_plf)
-{
- fast_forward = false;
- pause = false;
-}
-
-TrueServer::~TrueServer()
-{
-}
-
-void
-TrueServer::update()
-{
- if (fast_forward && !pause)
- {
- // To let the game run faster we just update it multiple
- // times
- for (int i = 0; i < 4; ++i)
- {
- Server::update();
- }
- }
- else
- {
- if (!pause)
- Server::update();
- }
-}
-
-void
-TrueServer::set_fast_forward(bool value)
-{
- fast_forward = value;
-}
-
-bool
-TrueServer::get_fast_forward()
-{
- return fast_forward;
-}
-
-void
-TrueServer::set_pause(bool value)
-{
- pause = value;
-}
-
-bool
-TrueServer::get_pause()
-{
- return pause;
-}
-
-void
-TrueServer::set_finished ()
-{
- goal_manager->set_abort_goal();
- set_pause(false);
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/true_server.hpp (from rev 2685,
branches/pingus_sdl/src/true_server.hxx)
Deleted: branches/pingus_sdl/src/true_server.hxx
===================================================================
--- branches/pingus_sdl/src/true_server.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/true_server.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,59 +0,0 @@
-// $Id: true_server.hxx,v 1.14 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_TRUE_SERVER_HXX
-#define HEADER_PINGUS_TRUE_SERVER_HXX
-
-#include "pingus_level.hxx"
-#include "server.hxx"
-
-
-/** FIXME: This whole Server/Client concept is screwed and the
- TrueServer/Server thing even more... */
-class TrueServer : public Server
-{
-private:
- bool fast_forward;
- bool pause;
-
-public:
- TrueServer(const PingusLevel& plf);
- virtual ~TrueServer();
-
- void update();
-
- void set_fast_forward(bool value);
- bool get_fast_forward();
-
- void set_pause(bool);
- bool get_pause();
-
- /** set the server into the finshed state, this is used when you
- press ESCAPE inside a game */
- void set_finished();
-
-private:
- TrueServer (const TrueServer&);
- TrueServer& operator= (const TrueServer&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/world.cpp (from rev 2685,
branches/pingus_sdl/src/world.cxx)
Deleted: branches/pingus_sdl/src/world.cxx
===================================================================
--- branches/pingus_sdl/src/world.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/world.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,294 +0,0 @@
-// $Id: world.cxx,v 1.47 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <algorithm>
-#include <assert.h>
-#include <iostream>
-#include <typeinfo>
-#include "pingu_holder.hxx"
-#include "sound/sound.hxx"
-#include "ground_map.hxx"
-#include "world.hxx"
-#include "particles/pingu_particle_holder.hxx"
-#include "particles/rain_particle_holder.hxx"
-#include "particles/smoke_particle_holder.hxx"
-#include "particles/snow_particle_holder.hxx"
-#include "pingu.hxx"
-#include "display/scene_context.hxx"
-#include "pingus_level.hxx"
-#include "worldobj_factory.hxx"
-#include "col_map.hxx"
-#include "game_time.hxx"
-
-
-using Actions::Bomber;
-
-static
-bool WorldObj_less (WorldObj* a, WorldObj* b)
-{
- return a->get_z_pos () < b->get_z_pos ();
-}
-
-World::World(const PingusLevel& plf)
- : ambient_light(Color(plf.get_ambient_light())),
- gfx_map(new GroundMap(plf)),
- game_time(new GameTime (game_speed)),
- do_armageddon(false),
- pingus(new PinguHolder(plf)),
- colmap(gfx_map->get_colmap()),
- gravitational_acceleration(0.25f)
-{
- WorldObj::set_world(this);
-
- std::cout << "create particle holder" << std::endl;
-
- // These get deleted via the world_obj vector in the destructor
- pingu_particle_holder = new Particles::PinguParticleHolder();
- rain_particle_holder = new Particles::RainParticleHolder();
- smoke_particle_holder = new Particles::SmokeParticleHolder();
- snow_particle_holder = new Particles::SnowParticleHolder();
-
- world_obj.push_back(gfx_map);
-
- world_obj.push_back(pingu_particle_holder);
- world_obj.push_back(rain_particle_holder);
- world_obj.push_back(smoke_particle_holder);
- world_obj.push_back(snow_particle_holder);
-
- init_worldobjs(plf);
-}
-
-void
-World::add_object (WorldObj* obj)
-{
- world_obj.push_back(obj);
-}
-
-void
-World::init_worldobjs(const PingusLevel& plf)
-{
- const std::vector<FileReader>& objects = plf.get_objects();
-
- for (std::vector<FileReader>::const_iterator i = objects.begin();
- i != objects.end ();
- ++i)
- {
- add_object(WorldObjFactory::instance()->create(*i));
- }
-
- world_obj.push_back(pingus);
-
- std::stable_sort (world_obj.begin (), world_obj.end (), WorldObj_less);
-
- // Drawing all world objs to the colmap, gfx, or what ever the
- // objects want to do
- for(WorldObjIter obj = world_obj.begin(); obj != world_obj.end(); ++obj)
- {
- (*obj)->on_startup();
- }
-}
-
-World::~World()
-{
- for (WorldObjIter it = world_obj.begin(); it != world_obj.end(); ++it) {
- delete *it;
- }
- delete game_time;
-}
-
-void
-World::draw (SceneContext& gc)
-{
- WorldObj::set_world(this);
-
- gc.light().fill_screen(Color(ambient_light));
-
- for(WorldObjIter obj = world_obj.begin(); obj != world_obj.end(); ++obj)
- {
- (*obj)->draw(gc);
- }
-}
-
-void
-World::draw_smallmap(SmallMap* smallmap)
-{
- WorldObj::set_world(this);
-
- for(WorldObjIter obj = world_obj.begin(); obj != world_obj.end(); ++obj)
- {
- (*obj)->draw_smallmap (smallmap);
- }
-}
-
-void
-World::update()
-{
- WorldObj::set_world(this);
-
- game_time->update ();
-
- if (do_armageddon)
- {
- if (game_time->get_ticks() % 4 == 0)
- {
- while (armageddon_count < pingus->get_end_id())
- {
- Pingu* pingu = pingus->get_pingu(armageddon_count);
-
- if (pingu && pingu->get_status() == PS_ALIVE)
- {
- pingu->request_set_action(Bomber);
- break;
- }
- else
- {
- ++armageddon_count;
- }
- }
-
- ++armageddon_count;
- }
- }
-
- // Let all pingus move and
- // Let the pingus catch each other and
- // Let the traps catch the pingus and
- // Let the exit catch the pingus
- for(WorldObjIter obj = world_obj.begin(); obj != world_obj.end(); ++obj)
- {
- // catch_pingu() is now done in relevant update() if WorldObj
- // needs to catch pingus.
- (*obj)->update();
- }
-}
-
-PinguHolder*
-World::get_pingus()
-{
- return pingus;
-}
-
-int
-World::get_width()
-{
- assert(gfx_map);
- return gfx_map->get_width();
-}
-
-int
-World::get_height()
-{
- assert(gfx_map);
- return gfx_map->get_height();
-}
-
-int
-World::get_time_passed()
-{
- return game_time->get_ticks();
-}
-
-void
-World::armageddon(void)
-{
- Sound::PingusSound::play_sound (Sound::GOODIDEA);
- do_armageddon = true;
- armageddon_count = 0;
-}
-
-ColMap*
-World::get_colmap()
-{
- return colmap;
-}
-
-void
-World::play_sound(std::string name, const Vector3f& pos, float volume)
-{
- // FIXME: Stereo is for the moment disabled
- /*
- Vector3f center = view->get_center();
- float panning = pos.x - center.x;
- panning /= view->get_width()/2;
-
- if (panning > 1.0f)
- panning = 1.0f;
-
- if (panning < -1.0f)
- panning = -1.0f;
- */
- float panning = 0.0f;
-
- Sound::PingusSound::play_sound(name, volume, panning);
-}
-
-Pingu*
-World::get_pingu (const Vector3f& pos)
-{
- Pingu* current_pingu = 0;
- double distance = -1.0;
-
- for (PinguIter i = pingus->begin (); i != pingus->end (); ++i) {
- if ((*i)->is_over(int(pos.x), int(pos.y)))
- {
- if (distance == -1.0f || distance >= (*i)->dist((int) pos.x,
(int)pos.y))
- {
- current_pingu = (*i);
- distance = (*i)->dist((int)pos.x, (int)pos.y);
- }
- }
- }
-
- return current_pingu;
-}
-
-GameTime*
-World::get_game_time ()
-{
- return game_time;
-}
-
-float World::get_gravity()
-{
- return gravitational_acceleration;
-}
-
-void
-World::put(int x, int y, Groundtype::GPType p)
-{
-}
-
-void
-World::put(const CollisionMask& mask, int x, int y, Groundtype::GPType type)
-{
- gfx_map->put(mask.get_pixelbuffer(), x, y);
- colmap->put(mask.get_pixelbuffer(), x, y, type);
-}
-
-void
-World::remove(int x, int y)
-{
-}
-
-void
-World::remove(const CollisionMask&, int x, int y)
-{
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/world.hpp (from rev 2685,
branches/pingus_sdl/src/world.hxx)
Deleted: branches/pingus_sdl/src/world.hxx
===================================================================
--- branches/pingus_sdl/src/world.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/world.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,179 +0,0 @@
-// $Id: world.hxx,v 1.29 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLD_HXX
-#define HEADER_PINGUS_WORLD_HXX
-
-#include "pingus.hxx"
-#include <vector>
-#include <string>
-#include "math/color.hpp"
-#include "groundtype.hxx"
-#include "collision_mask.hpp"
-
-// Forward declarations
-class Vector3f;
-//class ActionHolder;
-class Entrance;
-class Exit;
-class Hotspot;
-class Liquid;
-class PinguHolder;
-class GroundMap;
-class PingusLevel;
-class Pingu;
-class Trap;
-class View;
-class ColMap;
-class WorldObj;
-class GameTime;
-class SmallMap;
-class SceneContext;
-
-namespace Particles {
- class PinguParticleHolder;
- class RainParticleHolder;
- class SmokeParticleHolder;
- class SnowParticleHolder;
-}
-
-/** The World holds all objects of the pingu enviroment.
-
- It holds the pingus, traps, exits, entrances, etc.. It keeps
- control that all objects become time to move and can catch each
- other. */
-class World
-{
-private:
- Color ambient_light;
-
- /** groundmap for the pingus */
- GroundMap* gfx_map;
-
- /** manager class for the time in the pingus world */
- GameTime* game_time;
-
- /** set to true once an armageddon got started */
- bool do_armageddon;
-
- /** FIXME: ugly hack to iterate over all pingus and make bombers out
- of them, should use pingus_id instead */
- unsigned int armageddon_count;
-
- std::vector<WorldObj*> world_obj;
- typedef std::vector<WorldObj*>::iterator WorldObjIter;
-
- // These pointers hold objects and must be deleted
- Particles::PinguParticleHolder* pingu_particle_holder;
- Particles::RainParticleHolder* rain_particle_holder;
- Particles::SmokeParticleHolder* smoke_particle_holder;
- Particles::SnowParticleHolder* snow_particle_holder;
- PinguHolder* pingus;
-
- // Pointers which are references to objects from other classes
- //ActionHolder* action_holder;
- ColMap* colmap;
-
- void init_worldobjs (const PingusLevel& plf);
-
- /** Acceleration due to gravity in the world */
- const float gravitational_acceleration;
-
-public:
- World(const PingusLevel& level);
- virtual ~World();
-
- /** Add an object to the world, obj needs to be new'ed the World
- make sure that it will get deleted */
- void add_object (WorldObj* obj);
-
- /** Draw the world onto the given SceneContext */
- void draw (SceneContext& gc);
-
- /** Draw the world onte the given SmallMap*/
- void draw_smallmap(SmallMap* smallmap);
-
- /** Update the World */
- void update ();
-
- /** Issue an armageddon, all Pingus will explode in some seconds. */
- void armageddon ();
-
- /** @return The absolute height of the world. */
- int get_height ();
- /** @return The absolute width of the world */
- int get_width();
-
- /** Returns the time passed since the level was started */
- int get_time_passed();
-
- /** @return A pointer to the collision map used in this world */
- ColMap* get_colmap();
-
- void put(int x, int y, Groundtype::GPType p = Groundtype::GP_GROUND);
- void put(const CollisionMask&, int x, int y, Groundtype::GPType);
-
- void remove(int x, int y);
- void remove(const CollisionMask&, int x, int y);
-
- /** @return A pointer to the worlds pingu particle holder */
- Particles::PinguParticleHolder* get_pingu_particle_holder () { return
pingu_particle_holder; }
-
- /** @return A pointer to the worlds rain particle holder */
- Particles::RainParticleHolder* get_rain_particle_holder () { return
rain_particle_holder; }
-
- /** @return A pointer to the worlds smoke particle holder */
- Particles::SmokeParticleHolder* get_smoke_particle_holder () { return
smoke_particle_holder; }
-
- /** @return A pointer to the worlds snow particle holder */
- Particles::SnowParticleHolder* get_snow_particle_holder () { return
snow_particle_holder; }
-
- /** @return true if the world is currently doing an armageddon */
- bool check_armageddon() { return do_armageddon; }
-
- /** Play a sound as if it would have been generated at the given
- position, adjust panning and volume by the position relative to
- the center of the screen
- @param name The name of the sound to play ("ohno", not "sounds/ohno.wav")
- @param pos Position from which the sound seems to come (z-pos is
- going to be ignored) void play_sound (std::string name, const
- @param volume The volume of the sound
- */
- void play_sound (std::string name, const Vector3f& pos, float volume = 0.5f);
-
- PinguHolder* get_pingus(void);
-
- /** @return the pingu at the given word coordinates, 0 if none is there */
- Pingu* get_pingu (const Vector3f& pos);
-
- /** Return a pointer to the GameTime object of this World */
- GameTime* get_game_time ();
-
- /** Get the acceleration due to gravity in the world */
- float get_gravity();
-
-private:
- World (const World&);
- World& operator= (const World&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/dot.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/dot.cxx)
Deleted: branches/pingus_sdl/src/worldmap/dot.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/dot.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldmap/dot.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,38 +0,0 @@
-// $Id: dot.cxx,v 1.7 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <assert.h>
-#include "../file_reader.hxx"
-#include "dot.hxx"
-
-namespace WorldMapNS {
-
-Dot::Dot(FileReader reader)
- : Drawable()
-{
- reader.read_vector("position", pos);
- reader.read_string("name", name);
-
- assert(!name.empty());
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/dot.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/dot.hxx)
Deleted: branches/pingus_sdl/src/worldmap/dot.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/dot.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldmap/dot.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,59 +0,0 @@
-// $Id: dot.hxx,v 1.8 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DOT_HXX
-#define HEADER_PINGUS_DOT_HXX
-
-#include <string>
-#include "../math/vector3f.hpp"
-#include "drawable.hxx"
-
-namespace WorldMapNS {
-
-/** A Dot is a node between all the pathes on the worldmap, there are
- LevelDots TubeDots and other availabe. */
-class Dot : public Drawable
-{
-protected:
- Vector3f pos;
-
-public:
- Dot(FileReader reader);
-
- /** Draw stuff that should be displayed if the mouse is over the dot */
- virtual void draw_hover(DrawingContext& gc) =0;
-
- Vector3f get_pos() { return pos; }
-
- virtual void on_click() =0;
-
- virtual bool finished() =0;
- virtual bool accessible() =0;
- /** makes the node accessible */
- virtual void unlock() =0;
-private:
- Dot (const Dot&);
- Dot& operator= (const Dot&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/dot_factory.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/dot_factory.cxx)
Deleted: branches/pingus_sdl/src/worldmap/dot_factory.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/dot_factory.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/dot_factory.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,48 +0,0 @@
-// $Id: dot_factory.cxx,v 1.5 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../pingus_error.hxx"
-#include "level_dot.hxx"
-#include "world_dot.hxx"
-#include "dot_factory.hxx"
-
-namespace WorldMapNS {
-
-Dot*
-DotFactory::create(FileReader reader)
-{
- if (reader.get_name() == "leveldot")
- {
- return new LevelDot(reader);
- }
- else if (reader.get_name() == "worlddot")
- {
- return new WorldDot(reader);
- }
- //else if (reader.get_name() == "tubedot")
- else
- {
- PingusError::raise("DotFactory: unknown tag: ");
- }
- return 0;
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/dot_factory.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/dot_factory.hxx)
Deleted: branches/pingus_sdl/src/worldmap/dot_factory.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/dot_factory.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/dot_factory.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,43 +0,0 @@
-// $Id: dot_factory.hxx,v 1.3 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DOT_FACTORY_HXX
-#define HEADER_PINGUS_DOT_FACTORY_HXX
-
-namespace WorldMapNS {
-
-class Dot;
-
-/** */
-class DotFactory
-{
-private:
-public:
- /** Create a Dot from a given piece of XML */
- static Dot* create(FileReader reader);
-private:
- DotFactory (const DotFactory&);
- DotFactory& operator= (const DotFactory&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/drawable.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/drawable.cxx)
Deleted: branches/pingus_sdl/src/worldmap/drawable.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/drawable.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/drawable.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,23 +0,0 @@
-// $Id: drawable.cxx,v 1.2 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "drawable.hxx"
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/drawable.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/drawable.hxx)
Deleted: branches/pingus_sdl/src/worldmap/drawable.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/drawable.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/drawable.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,76 +0,0 @@
-// $Id: drawable.hxx,v 1.9 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DRAWABLE_HXX
-#define HEADER_PINGUS_DRAWABLE_HXX
-
-#include "../pingus_error.hxx"
-#include "../file_reader.hxx"
-
-class DrawingContext;
-
-namespace WorldMapNS {
-
-/** An drawable object on the worldmap, such has a background or a
- sprite, interface only */
-class Drawable
-{
-protected:
- /** The symbolic id of the drawable */
- std::string name;
-
- /** True if object should be visible, false otherwise */
- bool visible;
-
-public:
- Drawable()
- :visible(true)
- {
- }
-
- Drawable(std::string arg_name)
- : name(arg_name),
- visible(true)
- {
- }
-
- Drawable(FileReader reader)
- : visible(true)
- {
- reader.read_string("name", name);
- }
-
- virtual ~Drawable() {}
-
- bool is_visible() { return visible; }
- std::string get_name() { return name; }
-
- virtual void draw(DrawingContext& gc) =0;
- virtual void update(float delta) =0;
-
-private:
- Drawable (const Drawable&);
- Drawable& operator= (const Drawable&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/drawable_factory.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/drawable_factory.cxx)
Deleted: branches/pingus_sdl/src/worldmap/drawable_factory.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/drawable_factory.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldmap/drawable_factory.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,43 +0,0 @@
-// $Id: drawable_factory.cxx,v 1.2 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "surface_drawable.hxx"
-#include "sprite_drawable.hxx"
-#include "drawable_factory.hxx"
-
-namespace WorldMapNS {
-
-Drawable*
-DrawableFactory::create(FileReader reader)
-{
- if (reader.get_name() == "surface")
- {
- return new SurfaceDrawable(reader);
- }
- else
- {
- std::cout << "DrawableFactory::create(): Can't create " <<
reader.get_name() << std::endl;
- return 0;
- }
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/drawable_factory.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/drawable_factory.hxx)
Deleted: branches/pingus_sdl/src/worldmap/drawable_factory.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/drawable_factory.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldmap/drawable_factory.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,43 +0,0 @@
-// $Id: drawable_factory.hxx,v 1.3 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_DRAWABLE_FACTORY_HXX
-#define HEADER_DRAWABLE_FACTORY_HXX
-
-#include "drawable.hxx"
-
-namespace WorldMapNS {
-
-/** */
-class DrawableFactory
-{
-private:
-public:
- /** Create a new drawable */
- static Drawable* create(FileReader reader);
-private:
- DrawableFactory (const DrawableFactory&);
- DrawableFactory& operator= (const DrawableFactory&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/graph.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/graph.cxx)
Deleted: branches/pingus_sdl/src/worldmap/graph.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/graph.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldmap/graph.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,29 +0,0 @@
-// $Id: graph.cxx,v 1.12 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "graph.hxx"
-
-namespace WorldMapNS {
-
-const NodeId NoNode = -1;
-const EdgeId NoEdge = -1;
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/graph.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/graph.hxx)
Deleted: branches/pingus_sdl/src/worldmap/graph.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/graph.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldmap/graph.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,185 +0,0 @@
-// $Id: graph.hxx,v 1.24 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_GRAPH_HXX
-#define HEADER_GRAPH_HXX
-
-#include <algorithm>
-#include <assert.h>
-#include <iostream>
-#include <vector>
-
-namespace WorldMapNS {
-
-typedef int NodeId;
-typedef int EdgeId;
-
-extern const NodeId NoNode;
-extern const EdgeId NoEdge;
-
-template<class NodeType>
-class Node
-{
-public:
- Node (const NodeType& d)
- : data (d)
- {}
-
- Node& operator= (const NodeType& d)
- {
- data = d;
- return *this;
- }
-
- NodeType data;
- std::vector<EdgeId> next;
-};
-
-template<class EdgeType>
-class Edge
-{
-public:
- NodeId source;
- NodeId destination;
- float cost;
-
- EdgeType data;
-
- Edge (const EdgeType& arg_data, const NodeId& s, const NodeId& d, float c)
- : source (s), destination (d), cost (c), data(arg_data)
- {
- }
-};
-
-template<class NodeType,
- class EdgeType>
-class Graph
-{
-private:
- std::vector<Node<NodeType> > nodes;
- std::vector<Edge<EdgeType> > edges;
-
-public:
- Graph ()
- {
- }
-
- Graph (const Graph&)
- {
- assert (false);
- }
-
- Graph& operator= (const Graph&)
- {
- assert (false);
- return *this;
- }
-
- ~Graph ()
- {
- }
-
- NodeId add_node (NodeType d)
- {
- nodes.push_back (Node<NodeType>(d));
- return NodeId (nodes.size ()-1);
- }
-
- EdgeId add_edge (const EdgeType& data, const NodeId& a, const NodeId& b,
float cost)
- {
- Edge<EdgeType> new_edge (data, a, b, cost);
- edges.push_back (new_edge);
- resolve_node(a).next.push_back ((int)edges.size()-1);
- return EdgeId (edges.size ()-1);
- }
-
- std::pair<EdgeId, EdgeId>
- add_bi_edge (const EdgeType& data, const NodeId& a, const NodeId& b, float
cost)
- {
- std::pair<EdgeId, EdgeId> ret;
- ret.first = add_edge (data, a, b, cost);
- ret.second = add_edge (data, b, a, cost);
- return ret;
- }
-
- void remove_node (const NodeId& node)
- {
- assert (!"remove_node: not implemented");
- }
-
- void remove_edge (const NodeId& node1, const NodeId& node2)
- {
- assert (!"remove_edge: not implemented");
- }
-
- Edge<EdgeType>& resolve_edge (const EdgeId& node)
- {
- // FIXME: No error handling
- return edges[node];
- }
-
- /** Translates a NodeId into the corresponding Node */
- Node<NodeType>& resolve_node (const NodeId& node)
- {
- // FIXME: No error handling
- return nodes[node];
- }
-
- Edge<EdgeType>& resolve_edge(const NodeId& source, const NodeId& destination)
- {
- // FIXME: this could be done faster with an adjacense matrix
- for (typename std::vector<Edge<EdgeType> >::iterator i = edges.begin();
- i != edges.end(); ++i)
- {
- if (i->source == source
- && i->destination == destination)
- return *i;
- }
- std::cout << "couldn't resolve edge: source=" << source << " destination="
<< destination << std::endl;
- assert(false);
- return *((Edge<EdgeType>*) 0);
- }
-
- /* FIXME: This might give problems under MSVC, so it could be better to not
use it */
- template<class Func>
- void for_each_node (Func func)
- {
- std::for_each (nodes.begin (), nodes.end (), func);
- }
-
- template<class Func>
- void for_each_edge (Func func)
- {
- std::for_each (edges.begin (), edges.end (), func);
- }
-
- int nodes_size () {
- return nodes.size ();
- }
-
- int max_node_handler_value () {
- return (int)nodes.size ();
- }
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/level_dot.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/level_dot.cxx)
Deleted: branches/pingus_sdl/src/worldmap/level_dot.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/level_dot.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/level_dot.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,196 +0,0 @@
-// $Id: level_dot.cxx,v 1.26 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <math.h>
-#include "../font.hpp"
-#include "../input/controller.hxx"
-#include "../input/pointer.hxx"
-#include "../gettext.h"
-#include "../globals.hxx"
-#include "../system.hxx"
-#include "../fonts.hxx"
-#include "../display/drawing_context.hxx"
-#include "../gui/screen_manager.hxx"
-#include "../resource.hxx"
-#include "../path_manager.hxx"
-#include "../start_screen.hxx"
-#include "../plf_res_mgr.hxx"
-#include "../savegame_manager.hxx"
-#include "../file_reader.hxx"
-#include "level_dot.hxx"
-
-namespace WorldMapNS {
-
-LevelDot::LevelDot(FileReader reader)
- : Dot(reader.read_section("dot")),
- green_dot_sur(Resource::load_sprite("core/worldmap/dot_green")),
- red_dot_sur(Resource::load_sprite("core/worldmap/dot_red")),
- unaccessible_dot_sur(Resource::load_sprite("core/worldmap/dot_invalid")),
-
highlight_green_dot_sur(Resource::load_sprite("core/worldmap/dot_green_hl")),
- highlight_red_dot_sur(Resource::load_sprite("core/worldmap/dot_red_hl"))
-{
-#if 0
- std::string resname;
- reader.read_string("levelname", resname);
-
- plf = PLFResMgr::load_plf(resname);
- levelname = plf.get_levelname();
-#endif
-}
-
-void
-LevelDot::draw(DrawingContext& gc)
-{
- Vector3f mpos; //// =
gc.screen_to_world(Vector3f(Input::Controller::get_current()->get_pointer()->get_x_pos(),
- ////
Input::Controller::get_current()->get_pointer()->get_y_pos()));
-
- float x = mpos.x - pos.x;
- float y = mpos.y - pos.y;
-
- bool highlight = false;
-
- if (sqrt(x*x + y*y) < 30.0f)
- highlight = true;
-
- Savegame* savegame = SavegameManager::instance()->get(levelname);
- if (savegame
- && (savegame->status == Savegame::FINISHED
- || savegame->status == Savegame::ACCESSIBLE))
- {
- if (savegame->status == Savegame::FINISHED)
- if (highlight)
- {
- gc.draw (highlight_green_dot_sur, pos);
- }
- else
- {
- gc.draw (green_dot_sur, pos);
- }
- else
- if (highlight)
- gc.draw (highlight_red_dot_sur, pos);
- else
- gc.draw (red_dot_sur, pos);
- }
- else
- {
- gc.draw (unaccessible_dot_sur, pos);
- }
-}
-
-void
-LevelDot::update(float delta)
-{
- UNUSED_ARG(delta);
-}
-
-void
-LevelDot::on_click()
-{
- std::cout << "Starting level: " << levelname << std::endl;
- ////ScreenManager::instance()->push_screen(new StartScreen(plf),
- ////true);
-}
-
-bool
-LevelDot::finished()
-{
- Savegame* savegame = SavegameManager::instance()->get(levelname);
- if (savegame && savegame->status == Savegame::FINISHED)
- return true;
- else
- return false;
-}
-
-bool
-LevelDot::accessible()
-{
- Savegame* savegame = SavegameManager::instance()->get(levelname);
- if (savegame && savegame->status != Savegame::NONE)
- return true;
- else
- return false;
-}
-
-
-void
-LevelDot::draw_hover(DrawingContext& gc)
-{
- int pos_correction = 0;
-
- if (accessible())
- {
- int length = Fonts::pingus_small.bounding_rect(0, 0,
_(get_plf().get_levelname())).get_width() / 2;
- int realpos = static_cast<int>(gc.world_to_screen(Vector3f(pos.x, pos.y,
0)).x);
- if (realpos - length < 0)
- pos_correction = realpos - length;
- else if (realpos + length > gc.get_width())
- pos_correction = realpos + length - static_cast<int>(gc.get_width());
-
- gc.print_center(Fonts::pingus_small,
- pos.x - (float)pos_correction,
- pos.y - 40,
- _(get_plf().get_levelname()),
- 10000);
- }
- else
- {
- int length = Fonts::pingus_small.bounding_rect(0, 0,
_("locked")).get_width() / 2;
- int realpos = static_cast<int>(gc.world_to_screen(Vector3f(pos.x, pos.y,
0)).x);
- if (realpos - length < 0)
- pos_correction = realpos - length;
- else if (realpos + length > gc.get_width())
- pos_correction = realpos + length - static_cast<int>(gc.get_width());
-
- gc.print_center(Fonts::pingus_small,
- pos.x - (float)pos_correction,
- pos.y - 30,
- _("locked"),
- 10000);
- }
-
- if (maintainer_mode)
- {
- gc.print_center(Fonts::pingus_small,
- pos.x, pos.y - 56,
- get_plf().get_resname(),
- 10000);
- }
-}
-
-void
-LevelDot::unlock()
-{
- Savegame* savegame = SavegameManager::instance()->get(levelname);
- if (savegame == 0 || savegame->status == Savegame::NONE)
- {
- Savegame savegame;
- savegame.status = Savegame::ACCESSIBLE;
- savegame.levelname = levelname;
- SavegameManager::instance()->store(savegame);
- }
- else
- {
- }
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/level_dot.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/level_dot.hxx)
Deleted: branches/pingus_sdl/src/worldmap/level_dot.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/level_dot.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/level_dot.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,65 +0,0 @@
-// $Id: level_dot.hxx,v 1.11 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDMAP_LEVEL_DOT_HXX
-#define HEADER_PINGUS_WORLDMAP_LEVEL_DOT_HXX
-
-#include "../sprite.hpp"
-#include "../pingus_level.hxx"
-#include "dot.hxx"
-
-namespace WorldMapNS {
-
-/** */
-class LevelDot : public Dot
-{
-private:
- Sprite green_dot_sur;
- Sprite red_dot_sur;
- Sprite unaccessible_dot_sur;
- Sprite highlight_green_dot_sur;
- Sprite highlight_red_dot_sur;
-
- std::string levelname;
- PingusLevel plf;
-
-public:
- LevelDot(FileReader reader);
-
- void draw(DrawingContext& gc);
- void draw_hover(DrawingContext& gc);
-
- void update(float delta);
- PingusLevel get_plf () const { return plf; }
- void on_click();
-
- bool finished();
- bool accessible();
- void unlock();
-
-private:
- LevelDot (const LevelDot&);
- LevelDot& operator= (const LevelDot&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/manager.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/manager.cxx)
Deleted: branches/pingus_sdl/src/worldmap/manager.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/manager.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/manager.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,363 +0,0 @@
-// $Id: manager.cxx,v 1.42 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../gettext.h"
-#include "../fonts.hxx"
-#include "../gui/display.hxx"
-#include "../gui/screen_manager.hxx"
-#include "../gui/surface_button.hxx"
-#include "../path_manager.hxx"
-#include "../res_descriptor.hxx"
-#include "../sound/sound.hxx"
-#include "../stat_manager.hxx"
-#include "worldmap.hxx"
-#include "worldmap_story.hxx"
-#include "pingus.hxx"
-#include "metamap.hxx"
-#include "manager.hxx"
-#include "../story_screen.hxx"
-
-namespace WorldMapNS {
-
-WorldMapManager* WorldMapManager::instance_ = 0;
-
-class WorldMapManagerCloseButton
- : public GUI::SurfaceButton
-{
-public:
- WorldMapManagerCloseButton();
- void on_click();
- void draw (DrawingContext& gc);
- void on_pointer_enter();
-};
-
-class WorldMapManagerStoryButton
- : public GUI::SurfaceButton
-{
-public:
- WorldMapManagerStoryButton();
- void on_click();
- void draw (DrawingContext& gc);
- void on_pointer_enter();
-};
-
-
-class WorldMapManagerCreditsButton
- : public GUI::SurfaceButton
-{
-public:
- WorldMapManagerCreditsButton();
- void on_click();
- void draw (DrawingContext& gc);
- void on_pointer_enter();
-};
-
-class WorldMapManagerEnterButton
- : public GUI::SurfaceButton
-{
-public:
- WorldMapManagerEnterButton();
- void on_click();
- void draw (DrawingContext& gc);
- void on_pointer_enter();
-};
-
-
-WorldMapManagerCreditsButton::WorldMapManagerCreditsButton()
- : GUI::SurfaceButton(Display::get_width() - 150, 0,
- ResDescriptor("core/worldmap/credits_button_normal"),
- ResDescriptor("core/worldmap/credits_button_pressed"),
- ResDescriptor("core/worldmap/credits_button_hover"))
-{
-}
-
-void
-WorldMapManagerCreditsButton::on_pointer_enter()
-{
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
-}
-
-
-
-void
-WorldMapManagerCreditsButton::draw (DrawingContext& gc)
-{
- SurfaceButton::draw(gc);
- gc.print_left(Fonts::chalk_small, (float)(Display::get_width() - 150 + 15),
5, _("Show Ending?"));
-}
-
-void
-WorldMapManagerCreditsButton::on_click()
-{
-#if 0
- ScreenManager::instance()->replace_screen
- (new
StoryScreen(WorldMapManager::instance()->get_worldmap()->get_end_story()),
true);
-#endif
-}
-
-WorldMapManagerStoryButton::WorldMapManagerStoryButton()
- : GUI::SurfaceButton(0, 0,
- ResDescriptor("core/worldmap/story_button_normal"),
- ResDescriptor("core/worldmap/story_button_pressed"),
- ResDescriptor("core/worldmap/story_button_hover"))
-{
-}
-
-void
-WorldMapManagerStoryButton::on_pointer_enter()
-{
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
-}
-
-
-
-void
-WorldMapManagerStoryButton::draw (DrawingContext& gc)
-{
- SurfaceButton::draw(gc);
- gc.print_left(Fonts::chalk_small, 10, 5, _("Show Story?"));
-}
-
-void
-WorldMapManagerStoryButton::on_click()
-{
-#if 0
- ScreenManager::instance()->replace_screen
- (new
StoryScreen(WorldMapNS::WorldMapManager::instance()->get_worldmap()->get_intro_story()),
true);
-#endif
-}
-
-WorldMapManagerCloseButton::WorldMapManagerCloseButton()
- : GUI::SurfaceButton(0, Display::get_height() - 37,
- ResDescriptor("core/worldmap/leave_button_normal"),
- ResDescriptor("core/worldmap/leave_button_pressed"),
- ResDescriptor("core/worldmap/leave_button_hover"))
-{
-}
-
-void
-WorldMapManagerCloseButton::on_pointer_enter()
-{
- SurfaceButton::on_pointer_enter();
- Sound::PingusSound::play_sound ("tick");
-}
-
-void
-WorldMapManagerCloseButton::draw (DrawingContext& gc)
-{
- SurfaceButton::draw(gc);
- gc.print_left(Fonts::chalk_small, 10, (float)Display::get_height() - 20,
_("Leave?"));
-}
-
-void
-WorldMapManagerCloseButton::on_click()
-{
- ScreenManager::instance ()->pop_screen ();
-}
-
-WorldMapManagerEnterButton::WorldMapManagerEnterButton()
- : GUI::SurfaceButton(Display::get_width() - 119, Display::get_height() - 37,
- ResDescriptor("core/worldmap/enter_button_normal"),
- ResDescriptor("core/worldmap/enter_button_pressed"),
- ResDescriptor("core/worldmap/enter_button_hover"))
-{
-}
-
-void
-WorldMapManagerEnterButton::on_pointer_enter()
-{
- SurfaceButton::on_pointer_enter();
- if (!WorldMapManager::instance()->get_worldmap()->get_pingus()->is_walking())
- {
- Sound::PingusSound::play_sound ("tick");
- }
-}
-
-void
-WorldMapManagerEnterButton::draw (DrawingContext& gc)
-{
- if (WorldMapManager::instance()->get_worldmap()->get_pingus()->is_walking())
- {
- gc.draw(button_surface, Vector3f((float)x_pos, (float)y_pos));
- }
- else
- {
- SurfaceButton::draw(gc);
- gc.print_left(Fonts::chalk_small,
- (float)Display::get_width() - 100,
- (float)Display::get_height() - 20,
- _("Enter?"));
- }
-}
-
-void
-WorldMapManagerEnterButton::on_click()
-{
- WorldMapManager::instance()->get_worldmap()->enter_level();
-}
-
-WorldMapManager::WorldMapManager ()
- : is_init(false),
- exit_worldmap(false),
- worldmap(0),
- new_worldmap(0)
- ////metamap(new MetaMap(path_manager.complete("metamap/metamap.xml")))
-{
- // FIXME: a bit ugly because of the proteced member, but should work
- // FIXME: well enough. GUIScreen could also use multi-inheritage,
- // FIXME: but that could lead to member function name conflicts
- worldmap_component = new WorldMapComponent();
- gui_manager->add (worldmap_component, true);
- gui_manager->add(new WorldMapManagerCloseButton(), true);
- gui_manager->add(new WorldMapManagerEnterButton(), true);
-
- gui_manager->add(new WorldMapManagerStoryButton(), true);
-}
-
-void
-WorldMapManager::load (const std::string& filename)
-{
- if (worldmap)
- delete worldmap;
-
- worldmap = new WorldMap(filename);
-
- bool credits_unlocked = false;
- StatManager::instance()->get_bool(worldmap->get_shortname() +
"-endstory-seen",
- credits_unlocked);
- if (credits_unlocked)
- {
- gui_manager->add(new WorldMapManagerCreditsButton(), true);
- }
-}
-
-void
-WorldMapManager::on_startup ()
-{
- exit_worldmap = false;
- Sound::PingusSound::stop_music();
-
-#if 0
- if (!worldmap)
- {
- load(path_manager.complete("worldmaps/" +
metamap->get_default_worldmap()));
- }
-#endif
-
- if (worldmap)
- worldmap->on_startup ();
-}
-
-WorldMapManager::~WorldMapManager ()
-{
- delete worldmap;
- delete new_worldmap;
- ////delete metamap;
-}
-
-void
-WorldMapManager::on_escape_press ()
-{
- //std::cout << "WorldMapManager::on_escape_press ()..." << std::endl;
- exit_worldmap = true;
-}
-
-void
-WorldMapManager::update (float delta)
-{
- UNUSED_ARG(delta);
-
- // Exit the word
- if (exit_worldmap)
- ScreenManager::instance ()->pop_screen ();
-
- // Check if new worldmap is set and if so, change it
- if (new_worldmap)
- {
- delete worldmap;
- worldmap = new_worldmap;
- new_worldmap = 0;
- }
-}
-
-void
-WorldMapManager::WorldMapComponent::draw (DrawingContext& gc)
-{
- WorldMapManager::instance()->worldmap->draw(gc);
-}
-
-void
-WorldMapManager::WorldMapComponent::update (float delta)
-{
- WorldMapManager::instance()->worldmap->update(delta);
- UNUSED_ARG(delta);
-}
-
-void
-WorldMapManager::WorldMapComponent::on_primary_button_press (int x, int y)
-{
- //std::cout << "Buton press" << std::endl;
- /** Fixme: insert Co. translation here */
- WorldMapManager::instance ()->worldmap->on_primary_button_press (x, y);
-}
-
-
-void
-WorldMapManager::WorldMapComponent::on_pointer_move (int x, int y)
-{
- WorldMapManager::instance ()->worldmap->on_pointer_move (x, y);
-}
-
-void
-WorldMapManager::WorldMapComponent::on_secondary_button_press (int x, int y)
-{
- //std::cout << "Buton press" << std::endl;
- /** Fixme: insert Co. translation here */
- WorldMapManager::instance ()->worldmap->on_secondary_button_press (x, y);
-}
-
-void
-WorldMapManager::change_map (const std::string& filename, NodeId node)
-{
- // Create the new worldmap and make it the current one
- new_worldmap = new WorldMap (path_manager.complete("worldmaps/" + filename));
- new_worldmap->set_pingus (node);
-}
-
-WorldMapManager*
-WorldMapManager::instance ()
-{
- if (instance_)
- return instance_;
- else
- return instance_ = new WorldMapManager ();
-}
-
-void WorldMapManager::deinit()
-{
- delete instance_;
- instance_ = 0;
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/manager.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/manager.hxx)
Deleted: branches/pingus_sdl/src/worldmap/manager.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/manager.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/manager.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,119 +0,0 @@
-// $Id: manager.hxx,v 1.24 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDMAP_MANAGER_HXX
-#define HEADER_PINGUS_WORLDMAP_MANAGER_HXX
-
-#include <string>
-#include "../gui/gui_manager.hxx"
-#include "../gui/gui_screen.hxx"
-
-namespace WorldMapNS {
-
-typedef int NodeId;
-class WorldMap;
-
-/** The WorldMapManager manages the worldmaps and the translation
- between two worldmaps, it also holds the GUI elements that are
- accessible in the WorldMap Screen */
-class WorldMapManager : public GUIScreen
-{
- /** FIXME: Workaround class to let the worldmap play with well
- FIXME: with the Screen, should be deleted at a later point. */
- class WorldMapComponent : public GUI::Component
- {
- public:
- WorldMapComponent () { }
-
- void on_primary_button_press (int x, int y);
- void on_secondary_button_press (int x, int y);
- void on_pointer_move(int x, int y);
-
- void draw (DrawingContext& gc);
- void update (float delta);
-
- bool is_at (int, int) { return true; }
-
- private:
- WorldMapComponent (const WorldMapComponent&);
- WorldMapComponent& operator= (const WorldMapComponent&);
-
- };
-
- WorldMapComponent* worldmap_component;
-
- friend class WorldMapComponent;
-private:
- static WorldMapManager* instance_;
-
- bool is_init;
- bool exit_worldmap;
-
- WorldMap* worldmap;
- WorldMap* new_worldmap;
-
- //MetaMap* metamap;
-
- WorldMapManager ();
-public:
- ~WorldMapManager ();
-
- void load (const std::string& filename);
-
- /** Check if WorldMap manager still needs to run and exit if if
- not */
- void update (float);
-
- /** @defgroup WorldMapManagerBindings Controller bindings of the
WorldMapManager
- @{*/
- /** Calculate the node that was clicked and set the pingu to walk
- to that node. If a node is double-cliked, the pingu should go
- faster. */
- void on_primary_button_press (int x, int y);
-
- /** Exit the WorldMapManager and return to the previous screen */
- void on_escape_press ();
- /** @}*/
-
- WorldMap* get_worldmap() { return worldmap; }
- //// MetaMap* get_metamap() { return metamap; }
-
- /** Change the current map to the given map
-
- @param filename the filename of the new map, filename must be
- @param filename relative to the worldmap directory
- @param filename Example: "volcano.pingus" */
- void change_map (const std::string& filename, NodeId node);
-
- /** Singleton access function */
- static WorldMapManager* instance ();
- static void deinit();
-private:
- /** Startup Hook of the Screen */
- void on_startup ();
-
- WorldMapManager (const WorldMapManager&);
- WorldMapManager& operator= (const WorldMapManager&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/metamap.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/metamap.cxx)
Deleted: branches/pingus_sdl/src/worldmap/metamap.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/metamap.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/metamap.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,132 +0,0 @@
-// $Id: metamap.cxx,v 1.32 2006/1/19 00:30:04 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2006 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "dot.hxx"
-#include "metamap.hxx"
-#include "path_graph.hxx"
-#include "graph.hxx"
-#include "../pingus_error.hxx"
-#include "../debug.hxx"
-#include "../globals.hxx"
-#include "../stat_manager.hxx"
-#include "../sexpr_file_reader.hpp"
-
-namespace WorldMapNS {
-
-// Constructor
-MetaMap::MetaMap(const std::string &filename_arg)
- : filename(filename_arg)
-{
-#if 0
- CL_InputSourceProvider_File provider(".");
- CL_DomDocument doc(provider.open_source(filename), true);
- CL_DomElement root = doc.get_document_element();
-
- XMLFileReader xml(root);
- parse_file(xml);
-#endif
- pout(PINGUS_DEBUG_WORLDMAP) << "Metamap Info: " <<
- " Default Node: " << default_node <<
- " Final Node: " << final_node <<
- " Default World Name: " << path_graph->get_dot(default_node)->get_name()
<< std::endl;
-}
-
-// Parse the XML file
-void
-MetaMap::parse_file(FileReader &reader)
-{
- if (reader.get_name() == "pingus-metamap")
- {
- parse_graph(reader.read_section("graph"));
- parse_properties(reader.read_section("head"));
- // FIXME: Implement this stuff eventually.
- // parse_objects(reader.read_section("objects"));
- // intro_story = new WorldMapStory(reader.read_section("intro_story"));
- // end_story = new WorldMapStory(reader.read_section("end_story"));
- }
- else
- PingusError::raise("MetaMap: " + filename + ": not a MetaMap file");
-
- if (!path_graph)
- PingusError::raise("MetaMap: " + filename + " missing Graph");
-}
-
-// Parse the nodes and edges
-void
-MetaMap::parse_graph(FileReader reader)
-{
- path_graph = new PathGraph(this, reader);
-}
-
-// Parse the properties of this file
-void
-MetaMap::parse_properties(FileReader reader)
-{
- // Get beginning and ending nodes.
- std::string node_name;
- reader.read_string("default-node", node_name);
- default_node = path_graph->lookup_node(node_name);
-
- unlock_default(node_name);
-
- reader.read_string("final-node", node_name);
- final_node = path_graph->lookup_node(node_name);
-}
-
-void
-MetaMap::unlock_default(const std::string &default_node_name)
-{
- bool is_opened = false;
- StatManager::instance()->get_bool(default_node_name + "-accessible",
is_opened);
- if (!is_opened)
- {
- StatManager::instance()->set_bool(default_node_name + "-accessible",
true);
- }
-}
-
-std::string
-MetaMap::get_default_worldmap()
-{
- return (path_graph->get_dot(default_node)->get_name());
-}
-
-std::string
-MetaMap::get_final_worldmap()
-{
- return (path_graph->get_dot(final_node)->get_name());
-}
-
-void
-MetaMap::finish_node(const std::string &worldmap_shortname)
-{
- StatManager::instance()->set_bool(worldmap_shortname + "-finished", true);
- // NodeId id = path_graph->lookup_node(worldmap_shortname);
- // FIXME: Not entirely sure how the whole pathfinder thing works,
- // FIXME: so I'm hardcoding this for now... <evil!!!>
- unlock_default("volcano");
-}
-
-MetaMap::~MetaMap()
-{
- delete path_graph;
-}
-
-} // WorldMap namespace
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/metamap.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/metamap.hxx)
Deleted: branches/pingus_sdl/src/worldmap/metamap.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/metamap.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/metamap.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,97 +0,0 @@
-// $Id: metamap.hxx,v 1.32 2006/1/19 00:30:04 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2006 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_METAMAP_HXX
-#define HEADER_PINGUS_METAMAP_HXX
-
-#include <string>
-
-
- class FileReader;
-
-namespace WorldMapNS {
-
- class Drawable;
- class PathGraph;
- typedef int EdgeId;
- typedef int NodeId;
-
-/** This class is used to connect the WorldMaps (or "islands").
- FIXME: Eventually, this should draw a picture of the globe so you
- FIXME: can watch your pingus sail around and pick which island/area
they want
- FIXME: to go to */
-class MetaMap {
-private:
- // here, a NodeId represents a WorldMap.
- NodeId default_node;
- NodeId final_node;
-
- /** The graph that represents the path between Nodes */
- PathGraph* path_graph;
-
- /** Filename of this Metamap */
- std::string filename;
-
-public:
- MetaMap(const std::string &filename_arg);
- ~MetaMap();
-
- /** Returns whether or not the given worldmap is accessible. Use the
<short-name>
- tag in the WorldMap XML file as the string variable. */
- bool is_accessible(const std::string &worldmap_shortname);
-
- /** Action to take when the worldmap has been completed. This should
record that
- fact, as well as unlock all other worldmaps */
- void set_finished(const std::string &worldmap_shortname);
-
- /** FIXME: Implement this when the MetaMap is viewable */
- void add_drawable(Drawable* drawable) { }
-
- /** Return the name of the default node in this metamap (which is a
worldmap) */
- std::string get_default_worldmap();
- std::string get_final_worldmap();
-
- /** Finish the specified node and unlock it's neighbors */
- void finish_node(const std::string &worldmap_shortname);
-
-private:
- /** Unlock surrounding nodes. This sets the "-accessible" tag in the
StatManager for
- the accessible worldmaps */
- void unlock_nodes();
- void unlock_default(const std::string &default_node_name);
-
- /** Parses the passed filename to get information about the MetaMap */
- void parse_file(FileReader &reader);
-
- /** Parses the <head> section */
- void parse_properties(FileReader reader);
-
- /** Parses the <graph> section */
- void parse_graph(FileReader reader);
-
- MetaMap();
- MetaMap (const MetaMap&);
- MetaMap& operator= (const MetaMap&);
-}; // MetaMap class.
-
-} // WorldMap namespace;
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/path.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/path.cxx)
Deleted: branches/pingus_sdl/src/worldmap/path.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/path.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldmap/path.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,111 +0,0 @@
-// $Id: path.cxx,v 1.8 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <algorithm>
-#include <assert.h>
-#include "path.hxx"
-
-namespace WorldMapNS {
-
-Path::Path()
- : path_length_valid (false)
-{
-}
-
-std::vector<Vector3f >::size_type
-Path::size()
-{
- return vec.size();
-}
-
-float
-Path::length()
-{
- if (path_length_valid)
- {
- return path_length;
- }
- else
- {
- path_length = calc_length ();
- path_length_valid = true;
- return path_length;
- }
-}
-
-float
-Path::calc_length()
-{
- if (vec.empty())
- {
- return 0.0f;
- }
- else
- {
- float length = 0;
- Vec::iterator prev = vec.begin();
- for(Vec::iterator next = prev + 1; next != vec.end(); ++next)
- {
- length += Vector3f ::distance2d(*prev, *next);
- prev = next;
- }
- return length;
- }
-}
-
-Vector3f
-Path::at(float vec_position)
-{
- assert(!vec.empty());
-
- Path::iterator current = vec.begin ();
- Path::iterator next = vec.begin () + 1;
-
- float comp_length = 0.0f;
- while (next != vec.end())
- {
- float length = Vector3f::distance2d(*current, *next);
-
- // The pingu is between current and next
- if (comp_length + length > vec_position)
- {
- float perc = (vec_position - comp_length) // length to walk from
current node
- / length;
-
- return Vector3f::interpolate(*current, *next, perc);
- }
-
- comp_length += length;
-
- ++current;
- ++next;
- }
- return vec.back();
-}
-
-void
-Path::reverse()
-{
- std::reverse(vec.begin (), vec.end ());
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/path.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/path.hxx)
Deleted: branches/pingus_sdl/src/worldmap/path.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/path.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldmap/path.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,92 +0,0 @@
-// $Id: path.hxx,v 1.5 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDMAP_PATH_HXX
-#define HEADER_PINGUS_WORLDMAP_PATH_HXX
-
-#include <algorithm>
-#include <vector>
-#include "../math/vector3f.hpp"
-
-namespace WorldMapNS {
-
-/** a wrapper class around std::vector<Vector>, which can calculate
- the length of the path and a few other things */
-class Path
-{
-private:
- typedef std::vector<Vector3f> Vec;
- Vec vec;
-
- bool path_length_valid;
- float path_length;
-
- float calc_length();
-public:
- typedef Vec::iterator iterator;
- typedef Vec::reverse_iterator reverse_iterator;
-
- Path();
-
- /** Return the number of nodes */
- Vec::size_type size();
-
- /** @return the length of the path in pixels */
- float length();
-
- /** walk a distance of vec_position on the path and return the position,
- positions between two Vectors are interpolated, if length is
- larger then path *back() will be returned */
- Vector3f at(float vec_position);
-
- bool empty() { return vec.empty(); }
- void clear() { path_length_valid = false; vec.clear(); }
-
- iterator begin() { return vec.begin(); }
- iterator end() { return vec.end(); }
- reverse_iterator rbegin() { return vec.rbegin(); }
- reverse_iterator rend() { return vec.rend(); }
-
- void push_back(const Vector3f& v) {
- path_length_valid = false;
- vec.push_back(v);
- }
-
- void insert(Path& p) {
- path_length_valid = false;
- //vec.insert(vec.end(), p.vec.begin(), p.vec.end());
- vec.reserve(vec.size() + p.vec.size ());
- std::copy(p.vec.begin(), p.vec.end(), std::back_inserter(vec));
- }
-
- void reverse_insert(Path& p) {
- path_length_valid = false;
- //vec.insert(vec.end(), p.vec.rbegin(), p.vec.rend());
- vec.reserve(vec.size() + p.vec.size ());
- std::copy(p.vec.rbegin(), p.vec.rend(), std::back_inserter(vec));
- }
-
- void reverse();
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/path_drawable.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/path_drawable.cxx)
Deleted: branches/pingus_sdl/src/worldmap/path_drawable.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/path_drawable.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/path_drawable.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,54 +0,0 @@
-// $Id: path_drawable.cxx,v 1.9 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../math/color.hpp"
-#include "../display/drawing_context.hxx"
-#include "path_drawable.hxx"
-
-namespace WorldMapNS {
-
-PathDrawable::PathDrawable (const Path& arg_path)
- : path(arg_path)
-{
-}
-
-void
-PathDrawable::draw (DrawingContext& gc)
-{
- Path::iterator prev = path.begin();
-
- for(Path::iterator next = prev + 1; next != path.end(); ++next)
- {
- gc.draw_line(prev->x, prev->y,
- next->x, next->y,
- Color(255, 255, 255));
- prev = next;
- }
-}
-
-void
-PathDrawable::update (float delta)
-{
- UNUSED_ARG(delta);
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/path_drawable.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/path_drawable.hxx)
Deleted: branches/pingus_sdl/src/worldmap/path_drawable.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/path_drawable.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/path_drawable.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,49 +0,0 @@
-// $Id: path_drawable.hxx,v 1.6 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PATH_DRAWABLE_HXX
-#define HEADER_PATH_DRAWABLE_HXX
-
-#include "drawable.hxx"
-#include "path_graph.hxx"
-
-namespace WorldMapNS {
-
-/** Drawable to show the path between two nodes, only used for
- debugging */
-class PathDrawable : public Drawable
-{
-private:
- Path path;
-public:
- PathDrawable(const Path& arg_path);
-
- void draw(DrawingContext& gc);
- void update(float delta);
-
-private:
- PathDrawable (const PathDrawable&);
- PathDrawable& operator= (const PathDrawable&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/path_graph.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/path_graph.cxx)
Deleted: branches/pingus_sdl/src/worldmap/path_graph.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/path_graph.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/path_graph.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,286 +0,0 @@
-// $Id: path_graph.cxx,v 1.23 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <math.h>
-#include "../file_reader.hxx"
-#include "../pingus_error.hxx"
-#include "dot.hxx"
-#include "dot_factory.hxx"
-#include "worldmap.hxx"
-#include "metamap.hxx"
-#include "pathfinder.hxx"
-#include "path_graph.hxx"
-#include "path_drawable.hxx"
-#include "../globals.hxx"
-
-namespace WorldMapNS {
-
-PathGraph::PathGraph(WorldMap* arg_worldmap, FileReader &reader)
- : worldmap(arg_worldmap)
- ////metamap(0)
-{
- parse_nodes(reader.read_section("nodes"));
- parse_edges(reader.read_section("edges"));
-
- init_cache();
-}
-
-PathGraph::PathGraph(MetaMap* arg_metamap, FileReader &reader)
- : worldmap(0),
- metamap(arg_metamap)
-
-{
- parse_nodes(reader.read_section("nodes"));
- parse_edges(reader.read_section("edges"));
-
- init_cache();
-}
-
-void delete_Path(Edge<Path*> x)
-{
- delete x.data;
-}
-
-PathGraph::~PathGraph()
-{
- graph.for_each_edge(delete_Path);
-}
-
-void
-PathGraph::parse_nodes(FileReader reader)
-{
- const std::vector<FileReader>& childs = reader.get_sections();
-
- for(std::vector<FileReader>::const_iterator i = childs.begin();
- i != childs.end(); ++i)
- {
- Dot* dot = DotFactory::create(*i);
- if (dot)
- {
- // add the dot to the pathfinding
- NodeId id = graph.add_node(dot);
-
- //std::cout << "Adding to lookup table: " << dot->get_name() <<
std::endl;
- node_lookup[dot->get_name()] = id;
-
- // add the dot to the list of drawables
- if (worldmap)
- worldmap->add_drawable(dot);
- else
- metamap->add_drawable(dot);
-
- // FIXME: should be use this for freeing the stuff?
- dots.push_back(dot);
- }
- else
- {
- std::cout << "PathGraph: Couldn't create node" << std::endl;
- }
- }
-}
-
-void
-PathGraph::parse_edges(FileReader reader)
-{
- const std::vector<FileReader>& childs = reader.get_sections();
-
- for(std::vector<FileReader>::const_iterator i = childs.begin();
- i != childs.end(); ++i)
- {
- if (i->get_name() == "edge")
- {
- std::string name;
- std::string source;
- std::string destination;
-
- i->read_string("name", name);
- i->read_string("source", source);
- i->read_string("destination", destination);
-
- // FIXME: add path-data parsing here
- Path* path = new Path();
-
- const std::vector<FileReader>& childs2 =
reader.read_section("positions").get_sections();
-
- for(std::vector<FileReader>::const_iterator j = childs2.begin();
- j != childs2.end(); ++j)
- {
- if (j->get_name() == "position")
- {
- Vector3f pos;
- j->read_float("x", pos.x);
- j->read_float("y", pos.y);
- j->read_float("z", pos.z);
- path->push_back(pos);
- }
- }
-
- Path full_path;
-
full_path.push_back(graph.resolve_node(lookup_node(source)).data->get_pos());
- full_path.insert(*path);
-
full_path.push_back(graph.resolve_node(lookup_node(destination)).data->get_pos());
-
- // FIXME: merge this together with the Pingus::distance() stuff in a
seperate Path class
- float cost = full_path.length();
-
- // FIXME: Memory leak
- if (worldmap && pingus_debug_flags & PINGUS_DEBUG_WORLDMAP)
- worldmap->add_drawable(new PathDrawable(full_path));
-
- // FIXME: No error checking,
- EdgeId id1 = graph.add_edge(path, // FIXME: Memory leak!
- lookup_node(destination),
lookup_node(source),
- cost /* costs */);
-
- Path* path2 = new Path();
- path2->reverse_insert(*path);
- //EdgeId id2 =
- graph.add_edge(path2, // FIXME: Memory leak!
- lookup_node(source), lookup_node(destination),
- cost /* costs */);
-
- //std::cout << "Cost: " << cost << std::endl;
-
- // FIXME: edge lookup is flawed, since we have different edges in
both directions
-
- edge_lookup[name] = id1;
- }
- else
- {
- PingusError::raise("PathGraph: unhandled: ");
- }
- }
-}
-
-PathfinderResult
-PathGraph::get_path(NodeId start_id, NodeId end_id)
-{
- Pathfinder<Dot*,Path*>*& pfinder = pathfinder_cache[start_id];
-
- if (!pfinder)
- {
- pfinder = new Pathfinder<Dot*, Path*>(graph, start_id);
- }
-
- return pfinder->get_result(end_id);
-}
-
-EdgeId
-PathGraph::lookup_edge(const std::string& name)
-{
- std::map<std::string, EdgeId>::iterator i = edge_lookup.find(name);
- if (i == edge_lookup.end())
- {
- std::cout << "Couldn't find EdgeId for: " << name << std::endl;
- return NoEdge;
- }
- else
- {
- return i->second;
- }
-}
-
-NodeId
-PathGraph::lookup_node(const std::string& name)
-{
- std::map<std::string, NodeId>::iterator i = node_lookup.find(name);
- if (i == node_lookup.end())
- {
- std::cout << "Couldn't find NodeId for: " << name << std::endl;
- return NoNode;
- }
- else
- {
- return i->second;
- }
-}
-
-std::string
-PathGraph::lookup_node(EdgeId id)
-{
- for (std::map<std::string, NodeId>::iterator i = node_lookup.begin();
- i != node_lookup.end(); ++i)
- {
- if (i->second == id)
- {
- return i->first;
- }
- }
- std::cout << "PathGraph: Couldn't find id: " << id << std::endl;
- return "error_node";
-}
-
-std::string
-PathGraph::lookup_edge(NodeId id)
-{
- for (std::map<std::string, EdgeId>::iterator i = node_lookup.begin();
- i != node_lookup.end(); ++i)
- {
- if (i->second == id)
- {
- return i->first;
- }
- }
- std::cout << "PathGraph: Couldn't find id: " << id << std::endl;
- return "error_node";
-}
-
-Dot*
-PathGraph::get_dot(NodeId id)
-{
- return graph.resolve_node(id).data;
-}
-
-Dot*
-PathGraph::get_dot(float x_pos, float y_pos)
-{
- for(std::vector<Dot*>::iterator i = dots.begin(); i != dots.end(); ++i)
- {
- float x = x_pos - (*i)->get_pos().x;
- float y = y_pos - (*i)->get_pos().y;
-
- if (sqrt(x*x + y*y) < 30.0f)
- return *i;
- }
- return 0;
-}
-
-NodeId
-PathGraph::get_id(Dot* dot)
-{
- for(std::vector<Dot*>::iterator i = dots.begin(); i != dots.end(); ++i)
- if (dot == *i)
- return (int)(i - dots.begin());
- return NoNode;
-}
-
-void
-PathGraph::init_cache()
-{
- // Init the pathfinder cache
- pathfinder_cache.resize(graph.max_node_handler_value());
- for(PFinderCache::iterator i = pathfinder_cache.begin();
- i != pathfinder_cache.end(); ++i)
- *i = 0;
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/path_graph.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/path_graph.hxx)
Deleted: branches/pingus_sdl/src/worldmap/path_graph.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/path_graph.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/path_graph.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,101 +0,0 @@
-// $Id: path_graph.hxx,v 1.12 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PATH_GRAPH_HXX
-#define HEADER_PATH_GRAPH_HXX
-
-#include <map>
-#include <vector>
-#include "../math/vector3f.hpp"
-#include "path.hxx"
-#include "pathfinder.hxx"
-#include "graph.hxx"
-
-namespace WorldMapNS {
-
-class Dot;
-class WorldMap;
-class MetaMap;
-
-/** This class represents the walkable path on the Worldmap */
-class PathGraph
-{
-private:
- // The pathgraph will have one of these, not both.
- WorldMap* worldmap;
- MetaMap* metamap;
-
-public:
- // FIXME: Memory leak? Where do we free stuff data inside the graph?
- // FIXME: shouldn't be public
- Graph<Dot*, Path*> graph;
-
- std::vector<Dot*> dots;
- typedef std::vector<Pathfinder<Dot*, Path*>* > PFinderCache;
- PFinderCache pathfinder_cache;
-private:
-
- // FIXME: This could/should probally be moved inside the graph (or not?!)
- /** Map to look up node names and get the coresponding id's */
- std::map<std::string, NodeId> node_lookup;
-
- /** Map to look up edge names and get the corresponding id's */
- std::map<std::string, EdgeId> edge_lookup;
-
-public:
- /** @param worldmap is a pointer to the worldmap that holds this
- PathGraph, it is used so that the PathGraph can insert its
- drawables into the world */
- PathGraph(WorldMap* worldmap, FileReader &reader);
- PathGraph(MetaMap* metamap, FileReader &reader);
-
- ~PathGraph();
-
- /** @return a list of positions to walk to reach node \a end, by
- starting from \a start */
- PathfinderResult get_path(NodeId start, NodeId end);
-
- /** Get a node by it id */
- Dot* get_dot(NodeId id);
-
- NodeId get_id(Dot*);
-
- /** Get a node by its position */
- Dot* get_dot(float x, float y);
-
- EdgeId lookup_edge(const std::string& name);
- NodeId lookup_node(const std::string& name);
-
- std::string lookup_node(EdgeId id);
- std::string lookup_edge(NodeId id);
-
-private:
- void parse_nodes(FileReader reader);
- void parse_edges(FileReader reader);
- void init_cache();
-
- PathGraph (const PathGraph&);
- PathGraph& operator= (const PathGraph&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/pathfinder.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/pathfinder.hxx)
Deleted: branches/pingus_sdl/src/worldmap/pathfinder.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/pathfinder.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/pathfinder.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,185 +0,0 @@
-// $Id: pathfinder.hxx,v 1.13 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PATHFINDER_HXX
-#define HEADER_PATHFINDER_HXX
-
-#include <queue>
-#include "graph.hxx"
-
-namespace WorldMapNS {
-
-struct PathfinderResult
-{
- std::vector<NodeId> path;
- float cost;
-};
-
-/** */
-template<class T, class C>
-class Pathfinder
-{
-public:
- class NodeStat
- {
- public:
- enum { CLOSED, UNKNOWN, OPEN} status;
-
- NodeId parent;
- float cost;
- NodeId handle;
-
- NodeStat ()
- : status (UNKNOWN),
- parent(-1),
- cost(0),
- handle (-1)
- {
- }
- };
-
-private:
- struct CostComp
- {
- Pathfinder<T, C>& pathfinder;
-
- CostComp(Pathfinder<T, C>& p) : pathfinder(p) {}
-
- bool operator()(NodeId a, NodeId b)
- {
- //std::cout << "Coast: " << pathfinder.stat_graph[a].cost << " " <<
pathfinder.stat_graph[b].cost << std::endl;
- return pathfinder.stat_graph[a].cost > pathfinder.stat_graph[b].cost;
- }
- };
-
- friend struct CostComp;
-
- Graph<T, C>& graph;
- NodeId start;
- std::priority_queue<NodeId, std::vector<NodeId>, CostComp> open_nodes;
- std::vector<NodeStat> stat_graph;
-
-public:
- /** Find pathes to all other nodes, by starting from the node \a s */
- Pathfinder (Graph<T, C>& g, NodeId s)
- : graph (g), start (s), open_nodes(CostComp(*this))
- {
- stat_graph.resize (graph.max_node_handler_value());
- push_to_open (start);
-
- while (!open_nodes.empty())
- {
- NodeId current = open_nodes.top ();
- open_nodes.pop ();
-
- //std::cout << "Current Node: " << current << " "
- //<< stat_graph[current].cost << std::endl;
-
- Node<T>& node = graph.resolve_node (current);
- for (std::vector<EdgeId>::iterator e = node.next.begin ();
- e != node.next.end ();
- ++e)
- {
- NodeId child_node = graph.resolve_edge(*e).destination;
- NodeStat& stat = stat_graph[child_node];
- float new_cost = stat_graph[current].cost +
graph.resolve_edge(*e).cost;
-
- if (stat.status == NodeStat::OPEN
- && stat.cost <= new_cost)
- {
- // do nothing, already now a better path
- }
- else
- {
- stat_graph[child_node].parent = current;
- stat_graph[child_node].cost = new_cost;
-
- if (!is_open (child_node))
- push_to_open (child_node);
- }
- }
- }
- //std::cout << "---DONE---" << std::endl;
- }
-
- /** The nodes to walk to reach end is returned in reverse order! so
- you have to handle the vector like a stack with .back() == .top() */
- std::vector<NodeId> get_path (NodeId end)
- {
- std::vector<NodeId> path;
- NodeId handle = end;
-
- do
- {
- path.push_back(handle);
- //std::cout << "Handle: " << handle
- //<< " Parent: " << stat_graph[handle].parent << std::endl;
-
- if (handle == start)
- {
- return path;
- }
- else if (handle == -1)
- {
- // no path found
- return std::vector<NodeId>();
- }
- else
- {
- handle = stat_graph[handle].parent;
- }
- }
- while (1);
- }
-
- /** @return the cost of the path to node */
- float get_cost(NodeId node)
- {
- return stat_graph[node].cost;
- }
-
- PathfinderResult get_result(NodeId node)
- {
- PathfinderResult res;
- res.path = get_path(node);
- res.cost = get_cost(node);
- return res;
- }
-
- void push_to_open (NodeId handle)
- {
- open_nodes.push (handle);
- stat_graph[handle].status = NodeStat::OPEN;
- }
-
- bool is_open (NodeId handle)
- {
- return stat_graph[handle].status == NodeStat::OPEN;
- }
-
-private:
- Pathfinder (const Pathfinder&);
- Pathfinder operator= (const Pathfinder&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/pingus.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/pingus.cxx)
Deleted: branches/pingus_sdl/src/worldmap/pingus.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/pingus.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldmap/pingus.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,261 +0,0 @@
-// $Id: pingus.cxx,v 1.34 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <math.h>
-#include "../math/vector3f.hpp"
-#include "../display/drawing_context.hxx"
-#include "dot.hxx"
-#include "../math.hxx"
-#include "../direction.hxx"
-#include "../resource.hxx"
-#include "pingus.hxx"
-
-namespace WorldMapNS {
-
-Pingus::Pingus (PathGraph* arg_path)
- : Drawable("pingus"),
- path(arg_path),
- sprite_standing (Resource::load_sprite("core/worldmap/pingus_standing")),
- arrow (Resource::load_sprite("core/worldmap/arrow"))
-{
- sprite.load(Direction::LEFT,
Resource::load_sprite("core/worldmap/pingus/left"));
- sprite.load(Direction::RIGHT,
Resource::load_sprite("core/worldmap/pingus/right"));
-
- final_target_node = NoNode;
- current_node = NoNode;
-}
-
-Pingus::~Pingus ()
-{
-}
-
-
-void
-Pingus::draw (DrawingContext& gc)
-{
- // Add 10 to z_pos so that the pingu gets drawn above the node it is
- // standing one
- if (final_target_node != NoNode && current_node == NoNode)
- {
- gc.draw(arrow, path->get_dot(final_target_node)->get_pos() + Vector3f(0,
0, 10));
- }
-
- if (!is_walking())
- {
- gc.draw(sprite_standing, pos);
- }
- else
- {
- // FIXME: Replace the sprite and add up/down here
- float direction = get_direction();
-
- if (direction >= 0 && direction < 180)
- gc.draw(sprite[Direction::RIGHT], pos + Vector3f(0, 0, 10));
- else
- gc.draw(sprite[Direction::LEFT], pos + Vector3f(0, 0, 10));
- }
-}
-
-void
-Pingus::update (float delta)
-{
- float direction = get_direction();
- if (direction >= 0 && direction < 180)
- sprite[Direction::RIGHT].update(delta);
- else
- sprite[Direction::LEFT].update(delta);
-
- if (is_walking())
- update_walk(delta);
-}
-
-void
-Pingus::update_walk (float delta)
-{
- float velocity = 70.0f;
-
- //std::cout << "Updating Walk: " << edge_path_position << "/" <<
edge_path_length << std::endl;
- // Update the edge_path_position
- edge_path_position += velocity * delta;
-
- if (edge_path_position > edge_path.length()) // target reached
- {
- if (node_path.empty ()) // final target reached
- {
- current_node = target_node;
- final_target_node = NoNode;
- }
- else // edge is traveled, now go to the next node
- {
- update_edge_path();
- }
- }
-
- // Recalc pingu position on the screen
- last_pos = pos;
- pos = calc_pos ();
-}
-
-float
-Pingus::get_direction() const
-{
- return (atan2(last_pos.x - pos.x,
- -(last_pos.y - pos.y)) / (float)Math::pi * 180.0f) + 180.0f;
-}
-
-bool
-Pingus::walk_to_node (NodeId target)
-{
- final_target_node = target;
-
- if (current_node == target)
- {
- return true;
- }
- else if (current_node != NoNode) // pingu stands still
- {
- const PathfinderResult& res = path->get_path (current_node, target);
-
- if (res.path.empty())
- {
- // No path could be found
- return false;
- }
- else
- {
- node_path = res.path;
-
- // Simulate that we just reached current_node, then update the
edge_path
- target_node = node_path.back(); // equal to current_node;
- node_path.pop_back();
- update_edge_path();
-
- current_node = NoNode;
- return true;
- }
- }
- else // pingu between two nodes
- {
- if (target_node == target)
- {
- node_path.clear();
- return true;
- }
- else if (source_node == target)
- {
- // Reverse the pingu
- std::swap(target_node, source_node);
- edge_path.reverse();
- edge_path_position = edge_path.length() - edge_path_position;
- node_path.clear();
- return true;
- }
- else
- {
- const PathfinderResult& node_path1 = path->get_path (source_node,
target);
- const PathfinderResult& node_path2 = path->get_path (target_node,
target);
-
- // Check that a path exist
- if (node_path1.path.empty())
- {
- if (node_path2.path.empty())
- {
- return false;
- }
- else
- {
- node_path = node_path2.path;
- }
- }
- else
- {
- // Select the shorter path
- if (node_path1.cost + edge_path_position
- < node_path2.cost + (edge_path.length() -
edge_path_position))
- { // walk to source node, which means to reverse the pingu
- node_path = node_path1.path;
-
- // Reverse the pingu
- std::swap(target_node, source_node);
- edge_path.reverse();
- edge_path_position = edge_path.length() - edge_path_position;
- }
- else
- { // walk to target_node
- node_path = node_path2.path;
- }
- }
-
- // Pop the first element on the stack, since we are already
targeting it
- node_path.pop_back();
-
- return true;
- }
- }
-}
-
-Vector3f
-Pingus::calc_pos ()
-{
- if (current_node != NoNode) // pingu stands still
- {
- return path->graph.resolve_node(current_node).data->get_pos ();
- }
- else // between two nodes
- {
- return edge_path.at(edge_path_position);
- }
-}
-
-void
-Pingus::set_position (NodeId node)
-{
- pos = path->get_dot(node)->get_pos();
- current_node = node;
-}
-
-void
-Pingus::update_edge_path()
-{
- // Update source and target nodes
- source_node = target_node;
- target_node = node_path.back ();
- node_path.pop_back (); // remove target node from list of nodes
-
- edge_path_position = 0.0f;
- edge_path.clear();
-
- Path* partial_path = path->graph.resolve_edge(source_node, target_node).data;
-
- edge_path.push_back(path->graph.resolve_node(source_node).data->get_pos());
- // Why do we need to reverse this?!
- edge_path.reverse_insert(*partial_path);
- edge_path.push_back(path->graph.resolve_node(target_node).data->get_pos());
-}
-
-bool
-Pingus::is_walking()
-{
- return current_node == NoNode;
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/pingus.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/pingus.hxx)
Deleted: branches/pingus_sdl/src/worldmap/pingus.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/pingus.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldmap/pingus.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,131 +0,0 @@
-// $Id: pingus.hxx,v 1.27 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDMAP_PINGUS_HXX
-#define HEADER_PINGUS_WORLDMAP_PINGUS_HXX
-
-#include <math.h>
-#include "../state_sprite.hxx"
-#include "drawable.hxx"
-#include "path_graph.hxx"
-
-namespace WorldMapNS {
-
-/** This is the representation of the horde of Pingus which will walk
- on the worldmap */
-class Pingus : public Drawable
-{
-private:
- PathGraph* path;
- StateSprite sprite;
- Sprite sprite_standing;
- Sprite arrow;
-
- /** The node on which the pingu currently stands, NoNode if the pingu is
- currently on the move to another node */
- NodeId current_node;
-
- /** The node from which the pingu as started its walk to the
- target_node, value is undefined when the pingu is currently
- standing on a node */
- NodeId source_node;
-
- /** The node to which the pingu is currently walking, value is
- undefined when the pingu is currently standing on a node. This
- is not the final target node (aka node_path.back()), but instead
- the end node of an edge */
- NodeId target_node;
-
- /** While the target_node holds the next node to which the pingu is
- walking, the final_target_node holds the node on which the pingu
- will stop */
- NodeId final_target_node;
-
- /** The node path to walk. The edge between two nodes is itself
- represented as a array of positions */
- std::vector<NodeId> node_path;
-
- /** The path which represents an edge between two nodes, it includes
- both source and destinations position, so it is complete */
- Path edge_path;
-
- /** The position in the edge_path, 0 means the pingu is on the
- source_node, edge_path_length means that the pingu has reached
- the target node. Position between edge_path nodes is
- interpolated. */
- float edge_path_position;
-
- /** Current position of the pingu, only for caching purpose */
- Vector3f pos;
-
- /** The position the pingu had before his current position, used to
- calculate its current direction */
- Vector3f last_pos;
-
-public:
- /** */
- Pingus (PathGraph* arg_path);
- ~Pingus ();
-
- void draw (DrawingContext& gc);
- void update (float delta);
-
- /** @return true if the node is reachable, false otherwise */
- bool walk_to_node (NodeId target);
-
- bool is_walking();
-
- /** @return the node on which the pingu is currently standing, 0 is
- returned if the pingu is currently between two nodes */
- NodeId get_node () {
- return current_node;
- }
-
- /** Set the pingu to the position of a given node */
- void set_position (NodeId node);
-
- /** return the current position in world coordinates */
- Vector3f get_pos() const { return pos; }
-
-private:
- /** Calculate the direction in which the pingu is heading, return
- value is in degrees => [0,360[, 0=north, 180=south, 270=east, 90=west */
- float get_direction() const;
-
- /** calculate the position of the pingu */
- Vector3f calc_pos ();
-
- void update_walk (float delta);
-
- void update_edge_path();
-
- float calc_edge_path_length();
-
- /** */
- Vector3f interpolate(const Vector3f& a, const Vector3f& b, float perc);
-
- Pingus (const Pingus&);
- Pingus& operator= (const Pingus&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/sprite_drawable.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/sprite_drawable.cxx)
Deleted: branches/pingus_sdl/src/worldmap/sprite_drawable.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/sprite_drawable.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldmap/sprite_drawable.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,44 +0,0 @@
-// $Id: sprite_drawable.cxx,v 1.5 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/drawing_context.hxx"
-#include "sprite_drawable.hxx"
-
-namespace WorldMapNS {
-
-SpriteDrawable::SpriteDrawable(FileReader reader)
- : Drawable(reader)
-{
-
-}
-
-SpriteDrawable::~SpriteDrawable()
-{
-
-}
-
-void
-SpriteDrawable::draw(DrawingContext& gc)
-{
- gc.draw(sprite, pos);
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/sprite_drawable.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/sprite_drawable.hxx)
Deleted: branches/pingus_sdl/src/worldmap/sprite_drawable.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/sprite_drawable.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldmap/sprite_drawable.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,56 +0,0 @@
-// $Id: sprite_drawable.hxx,v 1.4 2003/10/20 19:28:55 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_SPRITE_DRAWABLE_HXX
-#define HEADER_SPRITE_DRAWABLE_HXX
-
-#include "../sprite.hpp"
-#include "../math/vector3f.hpp"
-#include "drawable.hxx"
-
-namespace WorldMapNS {
-
-/** */
-class SpriteDrawable : public Drawable
-{
-private:
- Sprite sprite;
- Vector3f pos;
-
-public:
- SpriteDrawable(FileReader reader);
- ~SpriteDrawable();
-
- void draw(DrawingContext& gc);
-
- void update(float delta)
- {
- sprite.update(delta);
- }
-
-private:
- SpriteDrawable (const SpriteDrawable&);
- SpriteDrawable operator= (const SpriteDrawable&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/surface_drawable.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/surface_drawable.cxx)
Deleted: branches/pingus_sdl/src/worldmap/surface_drawable.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/surface_drawable.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldmap/surface_drawable.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,80 +0,0 @@
-// $Id: surface_drawable.cxx,v 1.8 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-
-#include "../resource.hxx"
-#include "../display/drawing_context.hxx"
-#include "manager.hxx"
-#include "worldmap.hxx"
-#include "pingus.hxx"
-#include "surface_drawable.hxx"
-
-namespace WorldMapNS {
-
-SurfaceDrawable::SurfaceDrawable(FileReader reader)
- : Drawable(reader)
-{
- auto_uncover = false;
- ResDescriptor desc;
-
- reader.read_desc ("surface", desc);
- reader.read_vector("position", pos);
- reader.read_bool ("auto-uncover", auto_uncover);
-
- surface = Resource::load_sprite(desc);
- std::cout << "XXX Desc: " << desc.res_name << std::endl;
-}
-
-void
-SurfaceDrawable::update(float delta)
-{
- UNUSED_ARG(delta);
-}
-
-void
-SurfaceDrawable::draw(DrawingContext& gc)
-{
- if (surface)
- {
- if (auto_uncover)
- {
- Vector3f pingus_pos =
WorldMapManager::instance()->get_worldmap()->get_pingus()->get_pos();
- // Pingu is not over the surface
- if (!(pingus_pos.x > pos.x && pingus_pos.x < pos.x +
surface.get_width()
- &&
- pingus_pos.y > pos.y && pingus_pos.y < pos.y +
surface.get_height()))
- {
- gc.draw(surface, pos);
- }
- else if (pingus_pos.z > pos.z + 1000)
- { // FIXME: Hack for the 0.6.0 release/tutorial world remove later
- gc.draw(surface, pos);
- }
- }
- else
- {
- gc.draw(surface, pos);
- }
- }
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/surface_drawable.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/surface_drawable.hxx)
Deleted: branches/pingus_sdl/src/worldmap/surface_drawable.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/surface_drawable.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldmap/surface_drawable.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,54 +0,0 @@
-// $Id: surface_drawable.hxx,v 1.8 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_SURFACE_DRAWABLE_HXX
-#define HEADER_SURFACE_DRAWABLE_HXX
-
-#include "../sprite.hpp"
-#include "../math/vector3f.hpp"
-#include "drawable.hxx"
-
-namespace WorldMapNS {
-
-/** */
-class SurfaceDrawable : public Drawable
-{
-private:
- Sprite surface;
- Vector3f pos;
- /** If set to true the surface will disappear if the pingu gets
- covered by it, so that the Pingu can travel into caves and other
- things, while the roof will disapear */
- bool auto_uncover;
-public:
- SurfaceDrawable(FileReader reader);
-
- void update(float delta);
- void draw(DrawingContext&);
-
-private:
- SurfaceDrawable (const SurfaceDrawable&);
- SurfaceDrawable& operator= (const SurfaceDrawable&);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/world_dot.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/world_dot.cxx)
Deleted: branches/pingus_sdl/src/worldmap/world_dot.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/world_dot.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/world_dot.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,45 +0,0 @@
-// $Id: world_dot.cxx,v 1.11 2006/1/19 19:28:55 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2006 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "world_dot.hxx"
-#include "../stat_manager.hxx"
-#include "../file_reader.hxx"
-
-namespace WorldMapNS {
-
-WorldDot::WorldDot(FileReader reader) :
- Dot(reader.read_section("dot")),
- is_accessible(false),
- is_finished(false)
-{
- // Get the status from the StatManger
- StatManager::instance()->get_bool(name + "-accessible", is_accessible);
- StatManager::instance()->get_bool(name + "-finished", is_finished);
-}
-
-void
-WorldDot::unlock()
-{
- is_accessible = true;
- StatManager::instance()->set_bool(name + "-accessible", true);
-}
-
-} // WorldMapNS namespace
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/world_dot.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/world_dot.hxx)
Deleted: branches/pingus_sdl/src/worldmap/world_dot.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/world_dot.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/world_dot.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,61 +0,0 @@
-// $Id: world_dot.hxx,v 1.11 2006/1/19 19:28:55 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2006 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDMAP_WORLD_DOT_HXX
-#define HEADER_PINGUS_WORLDMAP_WORLD_DOT_HXX
-
-#include "dot.hxx"
-
-namespace WorldMapNS {
-
-/** Represents a WorldMap dot on a MetaMap */
-class WorldDot : public Dot
-{
-private:
- bool is_accessible;
- bool is_finished;
-
-public:
- WorldDot(FileReader reader);
-
- /** Draw stuff that should be displayed if the mouse is over the dot */
- virtual void draw_hover(DrawingContext& gc) { UNUSED_ARG(gc); }
- virtual void draw(DrawingContext& gc) { UNUSED_ARG(gc); }
- virtual void update(float delta) { UNUSED_ARG(delta); }
-
- Vector3f get_pos() { return pos; }
-
- virtual void on_click() { }
-
- virtual bool finished() { return is_finished; }
- virtual bool accessible() { return is_accessible; }
-
- /** makes the node accessible */
- virtual void unlock();
-
-private:
- WorldDot (const WorldDot&);
- WorldDot& operator= (const WorldDot&);
-}; // WorldDot class
-
-} // WorldMapNS namespace
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/worldmap.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/worldmap.cxx)
Deleted: branches/pingus_sdl/src/worldmap/worldmap.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/worldmap.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/worldmap.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,448 +0,0 @@
-// $Id: worldmap.cxx,v 1.53 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include <iostream>
-#include "../gui/display.hxx"
-#include "../fonts.hxx"
-#include "../path_manager.hxx"
-#include "../stat_manager.hxx"
-#include "../savegame_manager.hxx"
-#include "../system.hxx"
-#include "../resource.hxx"
-#include "../globals.hxx"
-#include "../sound/sound.hxx"
-#include "../pingus_error.hxx"
-#include "../gettext.h"
-#include "../globals.hxx"
-#include "../sexpr_file_reader.hpp"
-#include "../debug.hxx"
-#include "../lisp/parser.hpp"
-#include "../lisp/lisp.hpp"
-#include "worldmap.hxx"
-#include "worldmap_story.hxx"
-#include "metamap.hxx"
-#include "manager.hxx"
-#include "pingus.hxx"
-#include "drawable_factory.hxx"
-#include "drawable.hxx"
-#include "dot.hxx"
-#include "level_dot.hxx"
-#include "path_graph.hxx"
-#include "../math.hxx"
-#include "../stat_manager.hxx"
-
-#include "../story_screen.hxx"
-#include "../gui/screen_manager.hxx"
-
-namespace WorldMapNS {
-
-WorldMap::WorldMap(const std::string& arg_filename)
- : filename(arg_filename),
- mouse_x(0),
- mouse_y(0)
-{
-#if 0
- CL_InputSourceProvider_File provider(".");
- CL_DomDocument doc(provider.open_source(filename), true);
- CL_DomElement root = doc.get_document_element();
-
- parse_file(XMLFileReader(root));
-#endif
- parse_file(FileReader::parse(filename));
-
- pingus = new Pingus(path_graph);
- set_starting_node();
- add_drawable(pingus);
-
- levelname_bg = Resource::load_sprite("core/worldmap/levelname_bg");
- gc_state.set_limit(Rect(Vector2i(0, 0), Size(width, height)));
-}
-
-WorldMap::~WorldMap()
-{
- for (DrawableLst::iterator i = drawables.begin (); i != drawables.end ();
++i)
- {
- delete (*i);
- }
- delete intro_story;
- delete end_story;
- delete path_graph;
-}
-
-void
-WorldMap::parse_file(FileReader reader)
-{
- if (reader.get_name() == "pingus-worldmap")
- {
- parse_graph(reader.read_section("graph"));
- parse_objects(reader.read_section("objects"));
- parse_properties(reader.read_section("head"));
- intro_story = new WorldMapStory(reader.read_section("intro_story"));
- end_story = new WorldMapStory(reader.read_section("end_story"));
- }
- else
- {
- PingusError::raise("WorldMap:" + filename + ": not a Worldmap file");
- }
-
- if (!path_graph)
- {
- PingusError::raise("WorldMap: " + filename + " missed Graph");
- }
-}
-
-void
-WorldMap::parse_objects(FileReader reader)
-{
- const std::vector<FileReader>& childs = reader.get_sections();
-
- for(std::vector<FileReader>::const_iterator i = childs.begin();
- i != childs.end(); ++i)
- {
- Drawable* drawable = DrawableFactory::create(*i);
-
- if (drawable)
- {
- objects.push_back(drawable);
- drawables.push_back(drawable);
- }
- else
- {
- std::cout << "WorldMap::parse_objects: Parse Error" << std::endl;
- }
- }
-}
-
-void
-WorldMap::parse_graph(FileReader reader)
-{
- path_graph = new PathGraph(this, reader);
-}
-
-void
-WorldMap::parse_properties(FileReader reader)
-{
- reader.read_string("music", music);
- reader.read_string("author", author);
- reader.read_string("name", name);
- reader.read_string("short-name", short_name);
- reader.read_string("email", email);
- reader.read_int("width", width);
- reader.read_int("height", height);
-
- // Get beginning and ending nodes.
- std::string node_name;
- reader.read_string("default-node", node_name);
- default_node = path_graph->lookup_node(node_name);
- reader.read_string("final-node", node_name);
- final_node = path_graph->lookup_node(node_name);
-}
-
-void
-WorldMap::draw (DrawingContext& gc)
-{
- Vector3f pingu_pos = pingus->get_pos();
-
- pingu_pos.x = Math::mid(float(gc.get_width()/2),
- pingu_pos.x,
- float(width - gc.get_width()/2));
-
- pingu_pos.y = Math::mid(float(gc.get_height()/2),
- pingu_pos.y,
- float(height - gc.get_height()/2));
-
- DrawingContext* display_gc = new DrawingContext();
-
- gc_state.set_pos(Vector2f(pingu_pos.x, pingu_pos.y));
-
- gc_state.push(*display_gc);
-
- // Blank out the screen in case the screen resolution is larger than
- // the worldmap picture.
- // FIXME: Should probably scale everything to match the resolution instead.
- gc.draw_fillrect(0, 0, (float)Display::get_width(),
(float)Display::get_height(),
- Color(0,0,0), -15000);
-
- for (DrawableLst::iterator i = drawables.begin (); i != drawables.end ();
++i)
- {
- (*i)->draw(*display_gc);
- }
-
- gc.draw(levelname_bg,
- Vector3f(gc.get_width()/2 - levelname_bg.get_width()/2,
- gc.get_height() - levelname_bg.get_height()));
-
- if (pingus->get_node() != NoNode)
- {
- LevelDot* leveldot =
dynamic_cast<LevelDot*>(path_graph->get_dot(pingus->get_node()));
-
- if (leveldot)
- {
- gc.print_center(Fonts::chalk_small,
- display_gc->get_width ()/2,
- display_gc->get_height() - 20,
- _(leveldot->get_plf().get_levelname()));
-
- }
- else
- {
- gc.print_center(Fonts::chalk_small,
- display_gc->get_width ()/2,
- display_gc->get_height() - 20,
- "---");
- }
- }
- else
- {
- gc.print_center(Fonts::chalk_small,
- display_gc->get_width ()/2,
- display_gc->get_height() - 20,
- _("...walking..."));
- }
-
- Vector3f mpos = display_gc->screen_to_world(Vector3f((float)mouse_x,
(float)mouse_y));
- Dot* dot = path_graph->get_dot(mpos.x, mpos.y);
- if (dot)
- {
- dot->draw_hover(*display_gc);
- }
- gc.draw(display_gc);
-
- gc_state.pop(*display_gc);
-}
-
-void
-WorldMap::update (float delta)
-{
- for (DrawableLst::iterator i = drawables.begin (); i != drawables.end ();
++i)
- {
- (*i)->update (delta);
- }
-}
-
-void
-WorldMap::on_startup()
-{
- Sound::PingusSound::play_music(music);
- update_locked_nodes();
-}
-
-void
-WorldMap::add_drawable(Drawable* drawable)
-{
- drawables.push_back(drawable);
-}
-
-void
-WorldMap::remove_drawable(Drawable* drawable)
-{
- UNUSED_ARG(drawable);
-}
-
-void
-WorldMap::set_pingus(NodeId id)
-{
- UNUSED_ARG(id);
-}
-
-void
-WorldMap::on_pointer_move(int x, int y)
-{
- mouse_x = x;
- mouse_y = y;
-}
-
-void
-WorldMap::on_primary_button_press(int x, int y)
-{
- Vector2f click_pos = gc_state.screen2world(Vector2i(x, y));
-
- if (pingus_debug_flags & PINGUS_DEBUG_WORLDMAP)
- {
- std::cout
- << "\n<leveldot>\n"
- << " <dot>\n"
- << " <name>leveldot_X</name>\n"
- << " <position>\n"
- << " <x>" << (int)click_pos.x << "</x>\n"
- << " <y>" << (int)click_pos.y << "</y>\n"
- << " <z>0</z>\n"
- << " </position>\n"
- << " </dot>\n"
- << " <levelname>level10.pingus</levelname>\n"
- << "</leveldot>\n" << std::endl;
- }
-
- Dot* dot = path_graph->get_dot(click_pos.x, click_pos.y);
- if (dot)
- {
- if (maintainer_mode)
- std::cout << "WorldMap: Clicked on: " << dot->get_name() << std::endl;
-
- if (path_graph->lookup_node(dot->get_name()) == pingus->get_node())
- {
- if (maintainer_mode)
- std::cout << "WorldMap: Pingu is on node, issue on_click()" <<
std::endl;
- dot->on_click();
- }
- else
- {
- if (dot->accessible())
- {
- if
(!pingus->walk_to_node(path_graph->lookup_node(dot->get_name())))
- {
- if (maintainer_mode)
- std::cout << "WorldMap: NO PATH TO NODE FOUND!" <<
std::endl;
- }
- else
- {
- StatManager::instance()->set_string(short_name +
"-current-node", dot->get_name());
- }
- }
- else
- {
- Sound::PingusSound::play_sound("chink");
- }
- }
- }
-}
-
-void
-WorldMap::on_secondary_button_press(int x, int y)
-{
- if (maintainer_mode)
- {
- Vector3f click_pos = gc_state.screen2world(Vector2i(x, y));
-
- Dot* dot = path_graph->get_dot(click_pos.x, click_pos.y);
- if (dot)
- { // FIXME: Dot NodeID missmatch...
- NodeId id = path_graph->get_id(dot);
- pingus->set_position(id);
- }
- }
-}
-
-void
-WorldMap::enter_level()
-{
- NodeId node = get_pingus()->get_node();
-
- if (node != NoNode)
- {
- Dot* dot = path_graph->get_dot(node);
- if (dot)
- {
- dot->on_click();
- }
- }
- else
- {
- if (maintainer_mode)
- std::cout << "WorldMap: Pingus not on level" << std::endl;
- }
-}
-
-struct unlock_nodes
-{
- PathGraph* path_graph;
- unlock_nodes(PathGraph* g)
- {
- path_graph = g;
- }
-
- void operator()(Node<Dot*>& node)
- {
- if (node.data->finished())
- {
- //std::cout << "Unlocking neightbours of: " << node.data << std::endl;
- for (std::vector<EdgeId>::iterator i = node.next.begin(); i !=
node.next.end(); ++i)
- {
- Edge<Path*>& edge = path_graph->graph.resolve_edge(*i);
-
- // FIXME: This should be identical to node.data->unlock(), but not
sure
- path_graph->graph.resolve_node(edge.source).data->unlock();
- path_graph->graph.resolve_node(edge.destination).data->unlock();
- }
- }
- }
-};
-
-void
-WorldMap::update_locked_nodes()
-{ // FIXME: This shouldn't be a polling function
- path_graph->graph.for_each_node(unlock_nodes(path_graph));
-
- bool credits_unlocked = false;
- StatManager::instance()->get_bool(short_name + "-endstory-seen",
credits_unlocked);
-
- if (!credits_unlocked)
- {
- // See if the last level is finished
- Dot* dot = path_graph->get_dot(final_node);
- if (dot)
- {
- if (dot->finished())
- {
-
////WorldMapManager::instance()->get_metamap()->finish_node(short_name);
- ////ScreenManager::instance()->replace_screen(new
StoryScreen(get_end_story()), true);
- }
- }
- else
- {
- std::cout << "Error: WorldMap: Last level missing" << std::endl;
- }
- }
-}
-
-// Determine starting node
-void
-WorldMap::set_starting_node()
-{
- // See if the user has played this map before. If not, use the
<default-node>
- // tag from the XML file.
- NodeId id;
- std::string node_name;
-
- if (StatManager::instance()->get_string(short_name + "-current-node",
node_name))
- {
- // Just in case that level doesn't exist, look it up.
- id = path_graph->lookup_node(node_name);
- if (id == NoNode)
- id = default_node;
- }
- else
- id = default_node;
-
- pingus->set_position(id);
-
- LevelDot* leveldot = dynamic_cast<LevelDot*>(path_graph->get_dot(id));
- leveldot->unlock();
-}
-
-bool
-WorldMap::is_final_map()
-{
- return false;
////(WorldMapManager::instance()->get_metamap()->get_final_worldmap() ==
short_name);
-}
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/worldmap.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/worldmap.hxx)
Deleted: branches/pingus_sdl/src/worldmap/worldmap.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/worldmap.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/worldmap.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,157 +0,0 @@
-// $Id: worldmap.hxx,v 1.32 2003/12/14 00:30:04 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDMAP_WORLDMAP_HXX
-#define HEADER_PINGUS_WORLDMAP_WORLDMAP_HXX
-
-#include <vector>
-#include "../sprite.hpp"
-#include "../file_reader.hxx"
-#include "../display/drawing_context.hxx"
-#include "../graphic_context_state.hxx"
-
-class Font;
-class DrawingContext;
-
-namespace WorldMapNS {
-
-typedef int EdgeId;
-typedef int NodeId;
-
-class WorldMapStory;
-class PathGraph;
-class Drawable;
-class Pingus;
-
-/** A class for loading, displaying and managing the worldmap. The
- worldmap is basically a multi-layered image and a path
- (bidirectional graph) where a pingu can walk on. Parts of the
- worldmap are hidable and will only get displayed at specific
- events (successfull level completions, etc.). */
-class WorldMap
-{
-private:
- Sprite levelname_bg;
-
- /** name of the file to parse */
- std::string filename;
-
- WorldMapStory *intro_story;
- WorldMapStory *end_story;
-
- typedef std::vector<Drawable*> ObjectLst;
- typedef std::vector<Drawable*> DrawableLst;
-
- int width;
- int height;
-
- std::string name;
- std::string short_name;
- std::string author;
- std::string email;
- std::string music;
-
- // Beginning and ending nodes are configurable by the XML file.
- NodeId default_node;
- NodeId final_node;
-
- Pingus* pingus;
-
- GraphicContextState gc_state;
-
- /** The graph that represents the path on the map */
- PathGraph* path_graph;
-
- /** A collection of drawable things, allocation and deallocation
- takes place elsewhere these are only references to other
- objects */
- DrawableLst drawables;
-
- /** A collection of drawables loaded from the xml file, this list
- gets deleted at the end */
- ObjectLst objects;
-
- int mouse_x;
- int mouse_y;
-public:
- /** Load the given*/
- WorldMap(const std::string& filename);
- ~WorldMap();
-
- Pingus* get_pingus() { return pingus; }
- WorldMapStory* get_intro_story() const { return intro_story; }
- WorldMapStory* get_end_story() const { return end_story; }
-
- void on_startup();
-
- std::string get_filename() const { return filename; }
- std::string get_shortname() const { return short_name; }
-
- bool is_final_map();
-
- void draw (DrawingContext& gc);
- void update (float delta);
-
- /** Enters the level on which the Pingu is currently standing */
- void enter_level();
-
- /** The the pingu to the given Node */
- void set_pingus(NodeId id);
-
- /** FIXME: Memory leak?! */
- void add_drawable(Drawable* drawable);
- void remove_drawable(Drawable* drawable);
-
- /** @return the shortest path between node1 and node2 */
- std::vector<EdgeId> find_path (NodeId node1, NodeId node2);
-
- /** x,y are in WorldMap CO, not ScreenCO */
- void on_primary_button_press(int x, int y);
- void on_secondary_button_press(int x, int y);
- void on_pointer_move(int x, int y);
-
-private:
- /** Parses a WorldMap XML file */
- void parse_file(FileReader reader);
-
- /** Parse the object section of the Worldmap XML file, it contains
- Sprites, Backgrounds and other things */
- void parse_objects(FileReader reader);
-
- /** Parse the graph section of the WorldMap XML file, it contains
- the path where the Pingu can walk on. */
- void parse_graph(FileReader reader);
-
- /** Parse the propertie section of a WorldMap XML file, it contains
- meta data such as the author or the name of the Worldmap */
- void parse_properties(FileReader reader);
-
- /** Unlock nodes according to the finished ones */
- void update_locked_nodes();
-
- /** Sets the starting level on the worldmap. Either take it from the
StatManager
- or use the "default-node" option from the XML file */
- void set_starting_node();
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/worldmap_story.cpp (from rev 2685,
branches/pingus_sdl/src/worldmap/worldmap_story.cxx)
Deleted: branches/pingus_sdl/src/worldmap/worldmap_story.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/worldmap_story.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/worldmap_story.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,71 +0,0 @@
-// $Id: worldmap_story.cxx,v 1.32 2005/12/06 00:30:04 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <algorithm>
-#include <vector>
-#include "worldmap_story.hxx"
-#include "../story_screen.hxx"
-#include "../file_reader.hxx"
-#include "../res_descriptor.hxx"
-#include "../pingus_error.hxx"
-#include "../string_format.hxx"
-#include "../fonts.hxx"
-#include "../gettext.h"
-
-namespace WorldMapNS {
-
- bool StoryPageCompare(const StoryPage& a, const StoryPage& b)
- {
- // Reverse the sort order since we pull the page off the back
- return (a.page_name > b.page_name);
- }
-
- WorldMapStory::WorldMapStory(const FileReader &reader)
- {
- reader.read_string("title", title);
- title = _(title);
- reader.read_string("music", music);
- FileReader all_pages = reader.read_section("pages");
-
- // Temporary objects
- ResDescriptor desc;
- std::string text;
- std::string page_name;
-
- // Read each page into the pages vector
- const std::vector<FileReader>& childs =
all_pages.get_sections();
- for(std::vector<FileReader>::const_iterator i = childs.begin();
- i != childs.end(); ++i)
- {
- page_name = i->get_name();
- i->read_desc("surface", desc);
- i->read_string("text", text);
- // Translate the text and break it up.
- text = StringFormat::break_line(_(text), 570,
Fonts::chalk_normal);
- pages.push_back(StoryPage(desc, text, page_name));
- }
- std::stable_sort(pages.begin(), pages.end(), &StoryPageCompare);
-
- if (pages.empty())
- PingusError::raise("WorldMapStory: WorldMap does not
include a valid story");
- }
-
-} // namespace WorldMapNS
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldmap/worldmap_story.hpp (from rev 2685,
branches/pingus_sdl/src/worldmap/worldmap_story.hxx)
Deleted: branches/pingus_sdl/src/worldmap/worldmap_story.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/worldmap_story.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldmap/worldmap_story.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,69 +0,0 @@
-// $Id: worldmap_story.hxx,v 1.32 2005/12/06 00:30:04 Jave27 Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDMAP_STORY_HXX
-#define HEADER_PINGUS_WORLDMAP_STORY_HXX
-
-#include <vector>
-#include <string>
-#include "../res_descriptor.hxx"
-
-
- class FileReader;
-
- class StoryPage
- {
- public:
- StoryPage() {}
-
- StoryPage(ResDescriptor arg_image, std::string arg_text,
std::string arg_name = "")
- : image(arg_image), text(arg_text), page_name(arg_name)
- {
-
- }
-
- ResDescriptor image;
- std::string text;
- std::string page_name;
- };
-
-namespace WorldMapNS {
-
- class WorldMapStory
- {
- public:
- WorldMapStory(const FileReader &reader);
- ~WorldMapStory() { }
-
- std::string get_title() const { return title; }
- std::string get_music() const { return music; }
- std::vector<StoryPage> get_pages() const { return pages; }
-
- private:
- std::string title;
- std::string music;
- std::vector<StoryPage> pages;
-
- }; // class WorldMapStory
-
-} // namespace WorldmapNS
-
-#endif
-
-/*EOF*/
Copied: branches/pingus_sdl/src/worldobj.cpp (from rev 2685,
branches/pingus_sdl/src/worldobj.cxx)
Deleted: branches/pingus_sdl/src/worldobj.cxx
===================================================================
--- branches/pingus_sdl/src/worldobj.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldobj.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,85 +0,0 @@
-// $Id: worldobj.cxx,v 1.13 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#include <typeinfo>
-#include <iostream>
-#include "worldobj.hxx"
-#include "display/scene_context.hxx"
-
-
-World* WorldObj::world;
-
-void
-WorldObj::set_world(World* arg_world)
-{
- world = arg_world;
-}
-
-WorldObj::WorldObj()
-{
- // z_pos = 0;
-}
-
-WorldObj::~WorldObj()
-{
-
-}
-
-void
-WorldObj::on_startup()
-{
- // do nothing
-}
-
-void
-WorldObj::update()
-{
- // do nothing
-}
-
-void
-WorldObj::draw_offset(int /*x*/, int /*y*/, float /*s*/)
-{
- // do nothing
- std::cout << "WorldObj::draw_offset(): not implemented, probally a bug: "
- << typeid(*this).name () << std::endl;
-}
-
-void
-WorldObj::draw_smallmap(SmallMap* smallmap)
-{
- UNUSED_ARG(smallmap);
-}
-
-void
-WorldObj::draw (SceneContext& gc)
-{
- // FIXME: I need some docu on the meaning of get_x_offset() and co.
- std::cout << "WorldObj:draw(SceneContext): Using compat-wrapper: "
- << typeid(*this).name () << std::endl;
-#if 0 // FIXME:
- draw_offset (static_cast<int>(gc.get_x_offset () + gc.get_width ()/2),
- static_cast<int>(gc.get_y_offset () + gc.get_height ()/2),
- gc.get_zoom ());
-#endif
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobj.hpp (from rev 2685,
branches/pingus_sdl/src/worldobj.hxx)
Deleted: branches/pingus_sdl/src/worldobj.hxx
===================================================================
--- branches/pingus_sdl/src/worldobj.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldobj.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,96 +0,0 @@
-// $Id: worldobj.hxx,v 1.13 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJ_HXX
-#define HEADER_PINGUS_WORLDOBJ_HXX
-
-#include "pingus.hxx"
-#include "file_reader.hxx"
-#include "sprite.hpp"
-#include "collision_mask.hpp"
-
-class SceneContext;
-class SmallMap;
-class World;
-
-/** All objects that act in the world should be derived from this
- * class, it provides access to all the important data from the world.
- * Each world object has a $z$-position which indicates the depth of the
- * object. By default, all world objects live on the same depth.
- */
-class WorldObj
-{
-protected:
- /** The World all WorldObjects live in. */
- static World* world;
-
-public:
- /** Set the world pointer for all world objects */
- static void set_world(World*);
-
- /** Return the current active world */
- static World* get_world () { return world; }
-
-public:
- /** Creates a new WorldObj*/
- WorldObj ();
-
- WorldObj (const WorldObj&) { }
- WorldObj& operator= (const WorldObj&) { return *this; }
-
- /** Destroys a world object */
- virtual ~WorldObj ();
-
- /** Returns the $z$-position of this object. */
- virtual float get_z_pos () const =0;
-
- /** Draws this WorldObject on the screen with the specified offset. If not
- * overloaded, this method does nothing.
- * (XXX: What are the bounds of this offset?)
- * @param x the $x$-coordinate of this object
- * @param y the $y$-coordinate of this object
- * @param s the scalar by with the object is zoomed (1.0 is default)
- */
- virtual void draw_offset (int x, int y, float s = 1.0);
-
- /** Draw the WorldObj to the given SceneContext */
- virtual void draw(SceneContext& gc);
- virtual void draw_smallmap(SmallMap* smallmap);
-
- /** Draws the objects collision map to the main collision map, draws
- stuff onto the gfx map or do other manipulations to the World */
- virtual void on_startup ();
-
- /** @return true if this WorldObj is empty and doesn't have an
- update() or draw() function, but only a on_startup() one. The
- World can so decide which objects need to stay active and which
- one can get purged after calling on_startup() */
- virtual bool purge_after_startup() { return false; }
-
- /** The update function is called once a game loop, the delta
- * specifies how much time is passed since the last update
- * delta = 1.0 means that one second of realtime has passed. */
- virtual void update ();
-};
-
-
-#endif
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/worldobj_factory.cpp (from rev 2685,
branches/pingus_sdl/src/worldobj_factory.cxx)
Deleted: branches/pingus_sdl/src/worldobj_factory.cxx
===================================================================
--- branches/pingus_sdl/src/worldobj_factory.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobj_factory.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,181 +0,0 @@
-// $Id: worldobj_data_factory.cxx,v 1.36 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "pingus_error.hxx"
-#include "worldobj_factory.hxx"
-
-#include "worldobjs/conveyor_belt.hxx"
-#include "worldobjs/entrance.hxx"
-#include "worldobjs/exit.hxx"
-#include "worldobjs/fake_exit.hxx"
-#include "worldobjs/groundpiece.hxx"
-#include "worldobjs/guillotine.hxx"
-#include "worldobjs/hammer.hxx"
-#include "worldobjs/hotspot.hxx"
-#include "worldobjs/ice_block.hxx"
-#include "worldobjs/info_box.hxx"
-#include "worldobjs/laser_exit.hxx"
-#include "worldobjs/liquid.hxx"
-#include "worldobjs/rain_generator.hxx"
-#include "worldobjs/smasher.hxx"
-#include "worldobjs/snow_generator.hxx"
-#include "worldobjs/solid_color_background.hxx"
-#include "worldobjs/spike.hxx"
-#include "worldobjs/starfield_background.hxx"
-#include "worldobjs/surface_background.hxx"
-#include "worldobjs/switch_door.hxx"
-#include "worldobjs/teleporter.hxx"
-#include "worldobjs/thunderstorm_background.hxx"
-#include "worldobjs/woodthing.hxx"
-
-using namespace WorldObjs;
-
-WorldObjFactory* WorldObjFactory::instance_ = 0;
-
-/** WorldObjAbstractFactory, interface for creating factories */
-class WorldObjAbstractFactory
-{
-public:
- WorldObjAbstractFactory (const std::string& id) {
- WorldObjFactory::instance ()->register_factory (id, this);
- }
-
- virtual ~WorldObjAbstractFactory() {}
-
- virtual WorldObj* create(const FileReader& reader) =0;
-
-private:
- WorldObjAbstractFactory (const WorldObjAbstractFactory&);
- WorldObjAbstractFactory& operator= (const WorldObjAbstractFactory&);
-};
-
-/** Template to create factories, usage:
- new WorldObjFactoryImpl<"liquid", Liquid>; */
-template<class T>
-class WorldObjFactoryImpl : public WorldObjAbstractFactory
-{
-public:
- WorldObjFactoryImpl (const std::string& id)
- : WorldObjAbstractFactory (id) {}
-
- WorldObj* create(const FileReader& reader) {
- return new T(reader);
- }
-
-private:
- WorldObjFactoryImpl (const WorldObjFactoryImpl&);
- WorldObjFactoryImpl& operator= (const WorldObjFactoryImpl&);
-};
-
-WorldObjFactory::WorldObjFactory ()
-{
- // Register all WorldObj's
-}
-
-WorldObjFactory*
-WorldObjFactory::instance ()
-{
- if ( ! instance_)
- {
- instance_ = new WorldObjFactory ();
-
- // Registring Factories
- new WorldObjFactoryImpl<Liquid>("liquid");
- new WorldObjFactoryImpl<Hotspot>("hotspot");
- new WorldObjFactoryImpl<Entrance>("entrance");
- new WorldObjFactoryImpl<WoodThing>("woodthing");
- new WorldObjFactoryImpl<Exit>("exit");
-
- // traps
- new WorldObjFactoryImpl<FakeExit>("fake_exit");
- new WorldObjFactoryImpl<Guillotine>("guillotine");
- new WorldObjFactoryImpl<Hammer>("hammer");
- new WorldObjFactoryImpl<LaserExit>("laser_exit");
- new WorldObjFactoryImpl<Smasher>("smasher");
- new WorldObjFactoryImpl<Spike>("spike");
-
- // Special Objects
- new WorldObjFactoryImpl<SwitchDoor>("switchdoor");
- new WorldObjFactoryImpl<InfoBox>("infobox");
- new WorldObjFactoryImpl<IceBlock>("iceblock");
- new WorldObjFactoryImpl<ConveyorBelt>("conveyorbelt");
- new WorldObjFactoryImpl<Teleporter>("teleporter");
-
- // Backgrounds
- new WorldObjFactoryImpl<SurfaceBackground>("surface-background");
- new WorldObjFactoryImpl<StarfieldBackground>("starfield-background");
- new WorldObjFactoryImpl<SolidColorBackground>("solidcolor-background");
- new
WorldObjFactoryImpl<ThunderstormBackground>("thunderstorm-background");
-
- // Weather
- new WorldObjFactoryImpl<SnowGenerator>("snow-generator");
- new WorldObjFactoryImpl<RainGenerator>("rain-generator");
- // Weather-Backward compability
- new WorldObjFactoryImpl<SnowGenerator>("snow");
- new WorldObjFactoryImpl<RainGenerator>("rain");
-
- // Groundpieces
- new WorldObjFactoryImpl<Groundpiece>("groundpiece");
- }
-
- return instance_;
-}
-
-void WorldObjFactory::deinit()
-{
- if (instance_)
- {
- instance_->free_factories();
- delete instance_;
- instance_ = 0;
- }
-}
-
-WorldObj*
-WorldObjFactory::create(const FileReader& reader)
-{
- std::map<std::string, WorldObjAbstractFactory*>::iterator it =
factories.find(reader.get_name());
-
- if (it == factories.end())
- PingusError::raise("WorldObjFactory: Invalid id: '" + reader.get_name() +
"'");
- else
- return it->second->create(reader);
-
- return 0; // never reached
-}
-
-void
-WorldObjFactory::register_factory (const std::string& id,
- WorldObjAbstractFactory* factory)
-{
- factories[id] = factory;
-}
-
-void
-WorldObjFactory::free_factories()
-{
- for (std::map<std::string, WorldObjAbstractFactory*>::iterator i =
factories.begin(); i != factories.end(); ++i)
- {
- delete i->second;
- }
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobj_factory.hpp (from rev 2685,
branches/pingus_sdl/src/worldobj_factory.hxx)
Deleted: branches/pingus_sdl/src/worldobj_factory.hxx
===================================================================
--- branches/pingus_sdl/src/worldobj_factory.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobj_factory.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,62 +0,0 @@
-// $Id: worldobj_data_factory.hxx,v 1.10 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJ_DATA_FACTORY_HXX
-#define HEADER_PINGUS_WORLDOBJ_DATA_FACTORY_HXX
-
-#include <map>
-#include <string>
-#include "file_reader.hxx"
-
-
-class WorldObj;
-class WorldObjAbstractFactory;
-
-/** WorldObjFactory which can be used to create all kinds of
- WorldObj's by given its id */
-class WorldObjFactory
-{
-private:
- std::map<std::string, WorldObjAbstractFactory*> factories;
-
- static WorldObjFactory* instance_;
-
- WorldObjFactory ();
- void free_factories();
-public:
- /** Return the singleton instance */
- static WorldObjFactory* instance ();
- static void deinit();
- /** Register a factory for object creation */
- void register_factory(const std::string& id,
- WorldObjAbstractFactory* factory);
-
- /** Create a WorldObj type from a given piece of xml, use the
- 'type' property for determinating the object type. */
- WorldObj* create(const FileReader& reader);
-
-private:
- WorldObjFactory (const WorldObjFactory&);
- WorldObjFactory& operator= (const WorldObjFactory&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/conveyor_belt.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/conveyor_belt.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/conveyor_belt.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/conveyor_belt.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/conveyor_belt.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,96 +0,0 @@
-// $Id: conveyor_belt.cxx,v 1.25 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../resource.hxx"
-#include "../world.hxx"
-#include "conveyor_belt.hxx"
-
-namespace WorldObjs {
-
-ConveyorBelt::ConveyorBelt(const FileReader& reader)
- : left_sur (Resource::load_sprite ("worldobjs/conveyorbelt_left")),
- right_sur (Resource::load_sprite ("worldobjs/conveyorbelt_right")),
- middle_sur(Resource::load_sprite ("worldobjs/conveyorbelt_middle"))
-{
- reader.read_vector("position", pos);
- reader.read_int ("width", width);
- reader.read_float ("speed", speed);
-}
-
-void
-ConveyorBelt::draw (SceneContext& gc)
-{
- gc.color().draw(left_sur, pos);
- for (int i=0; i < width; ++i)
- gc.color().draw(middle_sur,
- Vector3f(static_cast<int>(pos.x + left_sur.get_width() + i *
middle_sur.get_width()),
- static_cast<int>(pos.y)));
-
- gc.color().draw(right_sur,
- Vector3f(static_cast<int>(pos.x + left_sur.get_width() + width *
middle_sur.get_width()),
- static_cast<int>(pos.y)));
-}
-
-void
-ConveyorBelt::on_startup ()
-{
- CollisionMask mask =
Resource::load_collision_mask("worldobjs/conveyorbelt_cmap");
-
- for (int i=0; i < (width + 2); ++i)
- world->put(mask,
- static_cast<int>(pos.x) + (15 * i),
- static_cast<int>(pos.y),
- Groundtype::GP_SOLID);
-}
-
-void
-ConveyorBelt::update ()
-{
- left_sur.update();
- middle_sur.update();
- right_sur.update();
-
- PinguHolder* holder = world->get_pingus();
- for (PinguIter pingu = holder->begin(); pingu != holder->end(); ++pingu)
- {
- if ( (*pingu)->get_pos().x > pos.x
- && (*pingu)->get_pos().x < pos.x + 15 * (width + 2)
- && (*pingu)->get_pos().y > pos.y - 2
- && (*pingu)->get_pos().y < pos.y + 10)
- {
- Vector3f pos = (*pingu)->get_pos();
- pos.x -= speed * 0.025f;
- (*pingu)->set_pos(pos);
- }
- }
-}
-
-float
-ConveyorBelt::get_z_pos () const
-{
- return pos.z;
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/conveyor_belt.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/conveyor_belt.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/conveyor_belt.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/conveyor_belt.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/conveyor_belt.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,61 +0,0 @@
-// $Id: conveyor_belt.hxx,v 1.20 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_CONVEYOR_BELT_HXX
-#define HEADER_PINGUS_WORLDOBJS_CONVEYOR_BELT_HXX
-
-#include "../math/vector3f.hpp"
-#include "../worldobj.hxx"
-
-namespace WorldObjsData {
-class ConveyorBeltData;
-}
-
-namespace WorldObjs {
-
-class ConveyorBelt : public WorldObj
-{
-private:
- Sprite left_sur;
- Sprite right_sur;
- Sprite middle_sur;
-
- Vector3f pos;
- int width;
- float speed;
- float counter;
-
-public:
- ConveyorBelt(const FileReader& reader);
-
- void draw (SceneContext& gc);
- void on_startup ();
- void update ();
- float get_z_pos () const;
-
-private:
- ConveyorBelt (const ConveyorBelt&);
- ConveyorBelt& operator= (const ConveyorBelt&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/entrance.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/entrance.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/entrance.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/entrance.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/entrance.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,166 +0,0 @@
-// $Id: entrance.cxx,v 1.14 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../display/scene_context.hxx"
-#include "../world.hxx"
-#include "../pingu_holder.hxx"
-#include "../globals.hxx"
-#include "../pingu.hxx"
-#include "../game_time.hxx"
-#include "../resource.hxx"
-#include "../components/smallmap.hxx"
-#include "entrance.hxx"
-
-namespace WorldObjs {
-
-Entrance::Entrance(const FileReader& reader)
- : smallmap_symbol(Resource::load_sprite("core/misc/smallmap_entrance"))
-{
- reader.read_string("type", type);
- reader.read_int ("owner-id", owner_id);
- reader.read_vector("position", pos);
- reader.read_int ("release-rate", release_rate);
-
- // Set default owner ID to 0
- if (owner_id < 0 || owner_id > 3) owner_id = 0;
-
- std::string direction_str;
- reader.read_string("direction", direction_str);
-
- if (direction_str == "left")
- direction = LEFT;
- else if (direction_str == "right")
- direction = RIGHT;
- else if (direction_str == "misc")
- direction = MISC;
- else
- {
- std::cout << "EntranceData: Unknown direction: '" << direction_str <<
"'" << std::endl;
- direction = MISC;
- }
-
- last_release = 150 - release_rate; // wait ~2sec at startup to allow a 'lets
go' sound
-}
-
-Entrance::~Entrance ()
-{
-}
-
-float
-Entrance::get_z_pos () const
-{
- return pos.z;
-}
-
-bool
-Entrance::pingu_ready ()
-{
- if (last_release + release_rate < (world->get_game_time()->get_ticks())) {
- last_release = world->get_game_time()->get_ticks();
- return true;
- } else {
- return false;
- }
-}
-
-void
-Entrance::create_pingu ()
-{
- static int last_direction;
- Direction d;
-
- Pingu* pingu = world->get_pingus()->create_pingu(pos, owner_id);
-
- if (pingu) // still pingus in the pool
- {
- switch (direction)
- {
- case LEFT:
- d.left();
- pingu->set_direction(d);
- break;
-
- case MISC:
- if (last_direction)
- {
- d.left();
- last_direction = 0;
- }
- else
- {
- d.right();
- last_direction = 1;
- }
- pingu->set_direction(d);
- break;
-
- case RIGHT:
- d.right();
- pingu->set_direction(d);
- break;
-
- default:
- std::cout << "Entrance:: Warning direction is wrong: " << direction
<< std::endl;
- d.right();
- pingu->set_direction(d);
- break;
- }
-
- // FIXME: Find the "oing" sound
- //world->play_sound("oing", pos);
- }
- else
- {
- //std::cout << "Entrance: pingu couldn't get created" << std::endl;
- }
-}
-
-void
-Entrance::update ()
-{
- if (pingu_ready() && (! world->check_armageddon()))
- {
- create_pingu();
- }
-}
-
-void
-Entrance::draw (SceneContext& gc)
-{
- if (!surface)
- {
- // Entrances have only a surface for historical reasons
- //std::cout << "Entrance::draw (SceneContext& gc): entrance without a
surface?!" << std::endl;
- return;
- }
-
- // FIXME: Why do we still have these hardcoded offsets?!
- gc.color().draw(surface, Vector3f(pos.x - 32, pos.y - 16));
-}
-
-void
-Entrance::draw_smallmap(SmallMap* smallmap)
-{
- smallmap->draw_sprite(smallmap_symbol, pos);
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/entrance.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/entrance.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/entrance.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/entrance.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/entrance.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,78 +0,0 @@
-// $Id: entrance.hxx,v 1.7 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_ENTRANCE_HXX
-#define HEADER_PINGUS_ENTRANCE_HXX
-
-#include "../math/vector3f.hpp"
-#include "../res_descriptor.hxx"
-#include "../worldobj.hxx"
-
-
-namespace WorldObjsData {
-class EntranceData;
-}
-
-class Pingu;
-
-namespace WorldObjs {
-
-/** A abstract representation of an entrance, the implementation
- currently sucks and needs to be rewritten */
-class Entrance : public WorldObj
-{
-protected:
- enum EntranceDirection { LEFT, RIGHT, MISC };
- EntranceDirection direction;
- Vector3f pos;
- int release_rate;
- int owner_id;
-
- /// The type of the entrance type (woodthing, generic, etc.)
- std::string type;
-
- Sprite smallmap_symbol;
- Sprite surface;
- int last_release;
-
-public:
- Entrance(const FileReader& reader);
- ~Entrance();
-
- float get_z_pos () const;
-
- virtual bool pingu_ready ();
- virtual void create_pingu ();
-
- virtual void update ();
-
- virtual void draw (SceneContext& gc);
-
- void draw_smallmap(SmallMap* smallmap);
-
-private:
- Entrance (const Entrance&);
- Entrance& operator= (const Entrance&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/exit.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/exit.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/exit.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/exit.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldobjs/exit.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,117 +0,0 @@
-// $Id: exit.cxx,v 1.11 2003/10/22 12:35:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../display/scene_context.hxx"
-#include "../col_map.hxx"
-#include "../world.hxx"
-#include "../globals.hxx"
-#include "../pingu_holder.hxx"
-#include "../pingu.hxx"
-#include "../components/smallmap.hxx"
-#include "../resource.hxx"
-#include "exit.hxx"
-
-namespace WorldObjs {
-
-Exit::Exit(const FileReader& reader)
- : smallmap_symbol(Resource::load_sprite("core/misc/smallmap_exit"))
-{
- ResDescriptor desc;
-
- reader.read_vector("position", pos);
- reader.read_desc ("surface", desc);
- reader.read_int ("owner-id", owner_id);
-
- // Set default owner ID to 0
- if (owner_id < 0 || owner_id > 3) owner_id = 0;
-
- flag = Resource::load_sprite("core/misc/flag"); ////+
CL_String::to(owner_id));
-
- sprite = Resource::load_sprite(desc);
-
- if (verbose > 2)
- std::cout << "Creating Exit" << std::endl;
-}
-
-Exit::~Exit ()
-{
-}
-
-void
-Exit::on_startup ()
-{
-#if 0
- world->get_colmap()->remove(sprite.get_frame_pixeldata(0),
- static_cast<int>(pos.x) - sprite.get_width()/2,
- static_cast<int>(pos.y) - sprite.get_height());
-#endif
-}
-
-void
-Exit::draw (SceneContext& gc)
-{
- gc.color().draw(sprite, pos);
- gc.color().draw(flag, pos + Vector3f(40, 0));
-}
-
-void
-Exit::draw_smallmap(SmallMap* smallmap)
-{
- smallmap->draw_sprite(smallmap_symbol, pos);
-}
-
-void
-Exit::update ()
-{
- sprite.update();
-
- PinguHolder* holder = world->get_pingus();
-
- for (PinguIter pingu = holder->begin(); pingu != holder->end(); ++pingu)
- {
- // Make sure this particular exit is allowed for this pingu
- if ((*pingu)->get_owner() == owner_id)
- {
- // Now, make sure the pingu is within range
- if ( (*pingu)->get_pos().x > pos.x - 1 && (*pingu)->get_pos().x <
pos.x + 1
- && (*pingu)->get_pos().y > pos.y - 5 && (*pingu)->get_pos().y
< pos.y + 2)
- {
- // Now, make sure the pingu isn't already exiting, gone, or dead
- if ( (*pingu)->get_status() != PS_EXITED
- && (*pingu)->get_status() != PS_DEAD
- && (*pingu)->get_action() != Actions::Exiter)
- {
- // Pingu actually exits
- (*pingu)->set_action(Actions::Exiter);
- }
- }
- }
- }
-}
-
-float
-Exit::get_z_pos () const
-{
- return pos.z;
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/exit.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/exit.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/exit.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/exit.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldobjs/exit.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,64 +0,0 @@
-// $Id: exit.hxx,v 1.5 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_EXIT_HXX
-#define HEADER_PINGUS_WORLDOBJS_EXIT_HXX
-
-#include "../res_descriptor.hxx"
-#include "../worldobj.hxx"
-
-namespace WorldObjsData {
-class ExitData;
-}
-
-namespace WorldObjs {
-
-class Exit : public WorldObj
-{
-private:
- Vector3f pos;
- int owner_id;
-
- Sprite sprite;
- Sprite flag;
- Sprite smallmap_symbol;
-
-public:
- Exit(const FileReader& reader);
- ~Exit();
-
- void on_startup ();
-
- void draw (SceneContext& gc);
- void draw_smallmap(SmallMap* smallmap);
-
- void update ();
-
- float get_z_pos () const;
-
-private:
- Exit (const Exit&);
- Exit& operator= (const Exit&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/fake_exit.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/fake_exit.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/fake_exit.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/fake_exit.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/fake_exit.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,94 +0,0 @@
-// $Id: fake_exit.cxx,v 1.16 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../world.hxx"
-#include "../components/smallmap.hxx"
-#include "../resource.hxx"
-#include "fake_exit.hxx"
-
-namespace WorldObjs {
-
-FakeExit::FakeExit(const FileReader& reader)
- : surface(Resource::load_sprite("traps/fake_exit")),
- smallmap_symbol(Resource::load_sprite("core/misc/smallmap_exit")),
- smashing(false)
-{
- reader.read_vector("position", pos);
- pos -= Vector3f((float)surface.get_width ()/2, (float)surface.get_height ());
-}
-
-float
-FakeExit::get_z_pos () const
-{
- return pos.z;
-}
-
-void
-FakeExit::draw (SceneContext& gc)
-{
- gc.color().draw (surface, pos);
-}
-
-
-void
-FakeExit::update ()
-{
- PinguHolder* holder = world->get_pingus();
- for (PinguIter pingu = holder->begin (); pingu != holder->end ();
++pingu)
- catch_pingu(*pingu);
-
- if (smashing)
- surface.update();
-}
-
-void
-FakeExit::catch_pingu (Pingu* pingu)
-{
- if (surface.is_finished())
- smashing = false;
-
- if ( pingu->get_pos().x > pos.x + 31 && pingu->get_pos().x < pos.x +
31 + 15
- && pingu->get_pos().y > pos.y + 56 && pingu->get_pos().y < pos.y + 56 +
56)
- {
- if (pingu->get_action() != Actions::Splashed)
- {
- if (!smashing)
- {
- surface.restart();
- smashing = true;
- }
-
- if (surface.get_current_frame() == 4)
- pingu->set_action(Actions::Splashed);
- }
- }
-}
-
-void
-FakeExit::draw_smallmap(SmallMap* smallmap)
-{
- smallmap->draw_sprite(smallmap_symbol, pos);
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/fake_exit.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/fake_exit.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/fake_exit.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/fake_exit.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/fake_exit.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,70 +0,0 @@
-// $Id: fake_exit.hxx,v 1.9 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_TRAPS_FAKE_EXIT_HXX
-#define HEADER_PINGUS_TRAPS_FAKE_EXIT_HXX
-
-#include "../worldobj.hxx"
-
-
-class Pingu;
-
-namespace WorldObjsData {
-class FakeExitData;
-} // namespace WorldObjsData
-
-namespace WorldObjs {
-
-/** The FakeExit is an object that looks similar to the traditional
- IceExit, but is really a trap that smashed all pingus that try to
- enter it. */
-class FakeExit : public WorldObj
-{
-private:
- Sprite surface;
- Sprite smallmap_symbol;
-
- Vector3f pos;
-
- bool smashing;
-
-public:
- FakeExit(const FileReader& reader);
-
- float get_z_pos () const;
-
- void draw (SceneContext& gc);
-
- void update ();
-
- /** Draws an exit symbol on to the small map. */
- void draw_smallmap(SmallMap* smallmap);
-
-private:
- void catch_pingu (Pingu*);
-
- FakeExit (const FakeExit&);
- FakeExit& operator= (const FakeExit&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/groundpiece.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/groundpiece.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/groundpiece.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/groundpiece.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/groundpiece.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,60 +0,0 @@
-// $Id: groundpiece.cxx,v 1.5 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../world.hxx"
-#include "../ground_map.hxx"
-#include "../col_map.hxx"
-#include "../resource.hxx"
-#include "groundpiece.hxx"
-
-namespace WorldObjs {
-
-Groundpiece::Groundpiece(const FileReader& reader)
-{
- reader.read_vector("position", pos);
- reader.read_desc ("surface", desc);
-
- gptype = Groundtype::GP_GROUND;
- reader.read_enum("type", gptype, &Groundtype::string_to_type);
-
- std::cout << "Groundpiece: " << desc.res_name << std::endl;
-
- // FIXME: we don't need to load surfaces here, providers would be
- // FIXME: enough and should be faster
-}
-
-void
-Groundpiece::on_startup ()
-{
- //// FIXME: We discard rotation here!
- std::cout << "Groundpiece::on_startup" << std::endl;
- CollisionMask mask = Resource::load_collision_mask(desc.res_name);
-
- // FIXME: overdrawing of bridges and similar things aren't handled
- // FIXME: here
- if (gptype == Groundtype::GP_REMOVE)
- get_world()->remove(mask, static_cast<int>(pos.x),
static_cast<int>(pos.y));
- else
- get_world()->put(mask, static_cast<int>(pos.x), static_cast<int>(pos.y),
gptype);
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/groundpiece.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/groundpiece.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/groundpiece.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/groundpiece.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/groundpiece.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,61 +0,0 @@
-// $Id: groundpiece.hxx,v 1.9 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_GROUNDPIECE_HXX
-#define HEADER_PINGUS_WORLDOBJS_GROUNDPIECE_HXX
-
-#include "../res_descriptor.hxx"
-#include "../groundtype.hxx"
-#include "../worldobj.hxx"
-#include "../math/vector3f.hpp"
-
-
-namespace WorldObjsData {
-class GroundpieceData;
-}
-
-namespace WorldObjs {
-
-/** Groundpieces form the ground on which the pingus can walk, which
- they can dig and which they can detonate away */
-class Groundpiece : public WorldObj
-{
-private:
- Vector3f pos;
- ResDescriptor desc;
- Groundtype::GPType gptype;
-
-public:
- Groundpiece(const FileReader& reader);
-
- float get_z_pos () const { return pos.z; }
-
- void draw (SceneContext&) {}
- void on_startup ();
- bool purge_after_startup () { return true; }
-private:
- Groundpiece (const Groundpiece&);
- Groundpiece& operator= (const Groundpiece&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/guillotine.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/guillotine.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/guillotine.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/guillotine.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/guillotine.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,106 +0,0 @@
-// $Id: guillotine.cxx,v 1.11 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../world.hxx"
-#include "../resource.hxx"
-#include "guillotine.hxx"
-
-namespace WorldObjs {
-
-Guillotine::Guillotine(const FileReader& reader)
- : sprite_kill_right (Resource::load_sprite("traps/guillotinekill/right")),
- sprite_kill_left (Resource::load_sprite("traps/guillotinekill/left")),
- sprite_idle (Resource::load_sprite("traps/guillotineidle")),
- killing(false)
-{
- reader.read_vector("position", pos);
-
-#if 0
- sprite_kill_right.set_play_loop(false);
- sprite_kill_left.set_play_loop(false);
- sprite_idle.set_play_loop(true);
-#endif
-}
-
-void
-Guillotine::draw (SceneContext& gc)
-{
- if (killing) {
- if (direction.is_left())
- gc.color().draw (sprite_kill_left, pos);
- else
- gc.color().draw (sprite_kill_right, pos);
- } else {
- gc.color().draw (sprite_idle, pos);
- }
-}
-
-
-float
-Guillotine::get_z_pos () const
-{
- return pos.z;
-}
-
-void
-Guillotine::update ()
-{
- // Only have to check one sprite because they update simultaneously
- if (sprite_kill_left.is_finished())
- killing = false;
-
- PinguHolder* holder = world->get_pingus();
- for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu)
- catch_pingu(*pingu);
-
- if (killing) {
- // Update both sprites so they finish at the same time.
- sprite_kill_left.update();
- sprite_kill_right.update();
- // FIXME: Should be a different sound
- if (sprite_kill_left.get_current_frame() == 7)
- WorldObj::get_world()->play_sound("splash", pos);
- } else {
- sprite_idle.update();
- }
-}
-
-void
-Guillotine::catch_pingu (Pingu* pingu)
-{
- if (!killing)
- {
- if (pingu->is_inside (static_cast<int>(pos.x + 38),
static_cast<int>(pos.y + 90),
- static_cast<int>(pos.x + 42),
static_cast<int>(pos.y + 98)))
- {
- killing = true;
- pingu->set_status(PS_DEAD);
- direction = pingu->direction;
- sprite_kill_left.restart();
- sprite_kill_right.restart();
- }
- }
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/guillotine.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/guillotine.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/guillotine.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/guillotine.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/guillotine.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,65 +0,0 @@
-// $Id: guillotine.hxx,v 1.7 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_GUILLOTINE_HXX
-#define HEADER_PINGUS_WORLDOBJS_GUILLOTINE_HXX
-
-#include "../direction.hxx"
-#include "../worldobj.hxx"
-
-
-namespace WorldObjsData {
-class GuillotineData;
-}
-
-class Pingu;
-
-namespace WorldObjs {
-
-class Guillotine : public WorldObj
-{
-private:
- Sprite sprite_kill_right;
- Sprite sprite_kill_left;
- Sprite sprite_idle;
- Vector3f pos;
- Direction direction;
-
- bool killing;
-
-public:
- Guillotine(const FileReader& reader);
-
- float get_z_pos() const;
-
- void update();
- void draw(SceneContext& gc);
-protected:
- void catch_pingu(Pingu*);
-
-private:
- Guillotine(const Guillotine&);
- Guillotine& operator=(const Guillotine&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/hammer.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/hammer.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/hammer.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/hammer.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/hammer.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,72 +0,0 @@
-// $Id: hammer.cxx,v 1.14 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../world.hxx"
-#include "../resource.hxx"
-#include "hammer.hxx"
-
-namespace WorldObjs {
-
-Hammer::Hammer(const FileReader& reader)
- : sprite(Resource::load_sprite("traps/hammer"))
-{
- reader.read_vector("position", pos);
-}
-
-float
-Hammer::get_z_pos() const
-{
- return pos.z;
-}
-
-void
-Hammer::draw(SceneContext& gc)
-{
- gc.color().draw(sprite, pos);
-}
-
-void
-Hammer::update()
-{
- sprite.update();
-
- if (sprite.is_finished())
- {
- PinguHolder* holder = world->get_pingus();
-
- for (PinguIter pingu_it = holder->begin (); pingu_it != holder->end ();
++pingu_it)
- {
- Pingu* pingu = *pingu_it;
- if (pingu->get_action() != Actions::Splashed)
- {
- if (pingu->get_x() > pos.x + 55 && pingu->get_x() < pos.x + 77
- && pingu->get_y() > pos.y + 146 && pingu->get_y() < pos.y +
185)
- pingu->set_action(Actions::Splashed);
- }
- }
- sprite.restart();
- }
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/hammer.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/hammer.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/hammer.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/hammer.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/hammer.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,57 +0,0 @@
-// $Id: hammer.hxx,v 1.10 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_HAMMER_HXX
-#define HEADER_PINGUS_WORLDOBJS_HAMMER_HXX
-
-#include "../worldobj.hxx"
-
-
-namespace WorldObjsData {
-class HammerData;
-} // namespace WorldObjsData
-
-class Pingu;
-
-namespace WorldObjs {
-
-class Hammer : public WorldObj
-{
-private:
- Sprite sprite;
- Vector3f pos;
-
-public:
- Hammer(const FileReader& reader);
-
- float get_z_pos() const;
-
- void draw(SceneContext& gc);
- void update();
-
-private:
- Hammer (const Hammer&);
- Hammer& operator= (const Hammer&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/hotspot.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/hotspot.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/hotspot.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/hotspot.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/hotspot.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,64 +0,0 @@
-// $Id: hotspot.cxx,v 1.9 2003/10/22 12:35:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../globals.hxx"
-#include "../display/scene_context.hxx"
-#include "../resource.hxx"
-#include "hotspot.hxx"
-
-namespace WorldObjs {
-
-Hotspot::Hotspot(const FileReader& reader)
-{
- ResDescriptor desc;
-
- reader.read_vector("position", pos);
- reader.read_desc ("surface", desc);
- reader.read_float ("parallax", para);
-
- sprite = Resource::load_sprite(desc);
-}
-
-Hotspot::~Hotspot ()
-{
-}
-
-void
-Hotspot::update()
-{
- sprite.update();
-}
-
-void
-Hotspot::draw (SceneContext& gc)
-{
- // FIXME: para support doesnn't work correctly
- gc.color().draw (sprite, pos);
-}
-
-float
-Hotspot::get_z_pos () const
-{
- return pos.z;
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/hotspot.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/hotspot.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/hotspot.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/hotspot.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/hotspot.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,56 +0,0 @@
-// $Id: hotspot.hxx,v 1.7 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_HOTSPOT_HXX
-#define HEADER_PINGUS_WORLDOBJS_HOTSPOT_HXX
-
-#include "../worldobj.hxx"
-
-namespace WorldObjsData {
-class HotspotData;
-}
-
-namespace WorldObjs {
-
-class Hotspot : public WorldObj
-{
-private:
- Sprite sprite;
- float para;
- Vector3f pos;
-
-public:
- Hotspot(const FileReader& reader);
- ~Hotspot();
-
- void draw(SceneContext& gc);
- void update();
- float get_z_pos() const;
-
-private:
- Hotspot (const Hotspot&);
- Hotspot& operator= (const Hotspot&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/worldobjs/ice_block.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/ice_block.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/ice_block.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/ice_block.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/ice_block.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,100 +0,0 @@
-// $Id: ice_block.cxx,v 1.24 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../col_map.hxx"
-#include "../game_time.hxx"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../ground_map.hxx"
-#include "../resource.hxx"
-#include "../world.hxx"
-#include "ice_block.hxx"
-
-namespace WorldObjs {
-
-IceBlock::IceBlock(const FileReader& reader)
- : thickness(1.0),
- is_finished(false),
- last_contact(0),
- block_sur(Resource::load_sprite ("worldobjs/iceblock"))
-{
- reader.read_vector("position", pos);
- reader.read_int ("width", width);
-}
-
-void
-IceBlock::on_startup ()
-{
- CollisionMask surf =
Resource::load_collision_mask("worldobjs/iceblock_cmap");
-
- world->put(surf,
- static_cast<int>(pos.x),
- static_cast<int>(pos.y),
- Groundtype::GP_GROUND);
-}
-
-void
-IceBlock::draw (SceneContext& gc)
-{
- if (is_finished)
- return;
-
- gc.color().draw(block_sur,
- pos);
- //, static_cast<int>((1.0 - thickness)
* (block_sur.get_frame_count() - 1)));
-}
-
-void
-IceBlock::update()
-{
- if (is_finished)
- return;
-
- PinguHolder* holder = world->get_pingus();
-
- for (PinguIter pingu = holder->begin(); pingu != holder->end(); ++pingu)
- {
- if ( (*pingu)->get_x() > pos.x && (*pingu)->get_x() < pos.x +
block_sur.get_width()
- && (*pingu)->get_y() > pos.y - 4 && (*pingu)->get_y() < pos.y +
block_sur.get_height())
- {
- last_contact = world->get_game_time()->get_ticks();
- }
- }
-
- if (last_contact && last_contact + 1000 >
world->get_game_time()->get_ticks())
- {
- //std::cout << "IceBlock: Catched Pingu: " << thickness << std::endl;
- thickness -= 0.01f;
-
- if (thickness < 0)
- {
- is_finished = true;
- thickness = 0;
-
- CollisionMask mask =
Resource::load_collision_mask("worldobjs/iceblock_cmap");
- world->remove(mask, static_cast<int>(pos.x), static_cast<int>(pos.y));
- return;
- }
- }
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/ice_block.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/ice_block.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/ice_block.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/ice_block.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/ice_block.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,62 +0,0 @@
-// $Id: ice_block.hxx,v 1.18 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_ICE_BLOCK_HXX
-#define HEADER_PINGUS_WORLDOBJS_ICE_BLOCK_HXX
-
-#include "../worldobj.hxx"
-
-namespace WorldObjsData {
-class IceBlockData;
-}
-
-namespace WorldObjs {
-
-class IceBlock : public WorldObj
-{
-private:
- /// The upper/left position of the iceblock's
- Vector3f pos;
-
- /** The number of iceblocks, only complete blocks are supported */
- int width;
-
- float thickness;
- bool is_finished;
- int last_contact;
- Sprite block_sur;
-
-public:
- IceBlock(const FileReader& reader);
-
- float get_z_pos () const { return pos.z; }
- void on_startup ();
- void draw (SceneContext& gc);
- void update ();
-
-private:
- IceBlock (const IceBlock&);
- IceBlock& operator= (const IceBlock&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/info_box.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/info_box.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/info_box.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/info_box.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/info_box.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,94 +0,0 @@
-// $Id: info_box.cxx,v 1.24 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../fonts.hxx"
-#include "../world.hxx"
-#include "../resource.hxx"
-#include "info_box.hxx"
-
-namespace WorldObjs {
-
-InfoBox::InfoBox(const FileReader& reader)
- : sprite(Resource::load_sprite("worldobjs/infobox")),
- is_open (false)
-{
- reader.read_vector("position", pos);
- reader.read_string("info-text", info_text);
-}
-
-void
-InfoBox::draw (SceneContext& gc)
-{
-#if 0 // FIXME:
- int x = static_cast<int>(gc.get_x_offset() + (gc.get_width ()/2));
- int y = static_cast<int>(gc.get_y_offset() + (gc.get_height()/2));
-
- int x_pos = static_cast<int>(pos.x) + x;
- int y_pos = static_cast<int>(pos.y) + y - 100;
-
- if (is_open)
- {
- int width = Fonts::pingus_small.bounding_rect(0, 0,
info_text).get_width();
- int border = 6;
- gc.color().draw_line(pos, pos + Vector3f(0, 0 - 100), 0.0f, 1.0f, 0.0f,
1.0f);
- gc.color().draw(sprite, pos);
- CL_Display::fill_rect(CL_Rect(x_pos - width/2 - border,
- y_pos - border,
- x_pos + width/2 + border,
- y_pos + Fonts::pingus_small.get_height() +
border),
- Color(0, 0, 0, 255));
- gc.print_center(Fonts::pingus_small, x_pos, y_pos, info_text);
- }
- else
- {
- gc.color().draw(sprite, pos);
- }
-#endif
-}
-
-void
-InfoBox::update ()
-{
- sprite.update();
-
- PinguHolder* holder = world->get_pingus();
- for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu)
- {
- if ((*pingu)->is_inside (static_cast<int>(pos.x - 16),
- static_cast<int>(pos.y - 32),
- static_cast<int>(pos.x + 16),
- static_cast<int>(pos.y)))
- {
- is_open = true;
- }
- }
-}
-
-float
-InfoBox::get_z_pos() const
-{
- return pos.z;
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/info_box.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/info_box.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/info_box.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/info_box.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/info_box.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,57 +0,0 @@
-// $Id: info_box.hxx,v 1.17 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_INFO_BOX_HXX
-#define HEADER_PINGUS_WORLDOBJS_INFO_BOX_HXX
-
-#include "../worldobj.hxx"
-
-namespace WorldObjsData {
-class InfoBoxData;
-}
-
-namespace WorldObjs {
-
-class InfoBox : public WorldObj
-{
-private:
- std::string info_text;
- Vector3f pos;
- Vector3f text_pos;
-
- Sprite sprite;
- bool is_open;
-
-public:
- InfoBox(const FileReader& reader);
-
- void draw(SceneContext& gc);
- void update();
- float get_z_pos () const;
-
-private:
- InfoBox (const InfoBox&);
- InfoBox& operator= (const InfoBox&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/laser_exit.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/laser_exit.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/laser_exit.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/laser_exit.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/laser_exit.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,84 +0,0 @@
-// $Id: laser_exit.cxx,v 1.15 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../world.hxx"
-#include "laser_exit.hxx"
-
-namespace WorldObjs {
-
-LaserExit::LaserExit(const FileReader& reader)
- : killing(false)
-{
- reader.read_vector("position", pos);
-}
-
-float
-LaserExit::get_z_pos () const
-{
- return pos.z;
-}
-
-void
-LaserExit::draw (SceneContext& gc)
-{
- gc.color().draw (surface, pos);
-}
-
-void
-LaserExit::update ()
-{
-
- PinguHolder* holder = world->get_pingus();
- for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu){
- catch_pingu(*pingu);
- }
-
- if (killing) {
- if (surface.is_finished()) {
- surface.restart();
- killing = false;
- } else {
- surface.update();
- }
- }
-}
-
-void
-LaserExit::catch_pingu (Pingu* pingu)
-{
- if (!killing)
- {
- if ( pingu->get_x () < pos.x + 34 + 10 && pingu->get_x () > pos.x + 34
- && pingu->get_y () < pos.y + 43 + 20 && pingu->get_y () > pos.y +
43)
- {
- if (pingu->get_action() != Actions::Laserkill)
- {
- killing = true;
- pingu->set_action(Actions::Laserkill);
- }
- }
- }
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/laser_exit.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/laser_exit.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/laser_exit.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/laser_exit.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/laser_exit.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,62 +0,0 @@
-// $Id: laser_exit.hxx,v 1.8 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_LASER_EXIT_HXX
-#define HEADER_PINGUS_WORLDOBJS_LASER_EXIT_HXX
-
-#include "../worldobj.hxx"
-#include "../sprite.hpp"
-
-namespace WorldObjsData {
-class LaserExitData;
-} // namespace WorldObjsData
-
-class Pingu;
-
-namespace WorldObjs {
-
-class LaserExit : public WorldObj
-{
-private:
- Sprite surface;
- Vector3f pos;
-
- bool killing;
-
-public:
- LaserExit(const FileReader& reader);
-
- float get_z_pos () const;
-
- void draw (SceneContext& gc);
- void update ();
-
-protected:
- void catch_pingu (Pingu*);
-
-private:
- LaserExit (const LaserExit&);
- LaserExit& operator= (const LaserExit&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/liquid.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/liquid.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/liquid.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/liquid.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/liquid.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,87 +0,0 @@
-// $Id: liquid.cxx,v 1.12 2003/10/22 12:35:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../resource.hxx"
-#include "../world.hxx"
-#include "liquid.hxx"
-
-namespace WorldObjs {
-
-Liquid::Liquid(const FileReader& reader)
- : old_width_handling(true),
- width(0)
-{
- /*
- if (XMLhelper::get_prop(cur, "use-old-width-handling", old_width_handling))
- {
- if (old_width_handling)
- std::cout << "XMLPLF: Using Old Width Handling: " << std::endl;
- }
- */
- ResDescriptor desc;
-
- reader.read_vector("position", pos);
- reader.read_desc ("surface", desc);
- reader.read_int ("width", width);
-
- if (!old_width_handling)
- width *= sur.get_width();
-
- sur = Resource::load_sprite(desc);
-}
-
-float
-Liquid::get_z_pos () const
-{
- return pos.z;
-}
-
-void
-Liquid::on_startup ()
-{
- CollisionMask mask = Resource::load_collision_mask("liquids/water_cmap");
-
- for(int i=0; i < width; ++i)
- world->put(mask,
- static_cast<int>(pos.x + i),
- static_cast<int>(pos.y),
- Groundtype::GP_WATER);
-}
-
-void
-Liquid::draw (SceneContext& gc)
-{
- for(int x = static_cast<int>(pos.x);
- x < pos.x + width;
- x += sur.get_width())
- gc.color().draw(sur, Vector3f(x, pos.y));
-}
-
-void
-Liquid::update()
-{
- sur.update(0.033f);
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/liquid.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/liquid.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/liquid.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/liquid.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/liquid.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,65 +0,0 @@
-// $Id: liquid.hxx,v 1.8 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_LIQUID_HXX
-#define HEADER_PINGUS_WORLDOBJS_LIQUID_HXX
-
-#include "../res_descriptor.hxx"
-#include "../worldobj.hxx"
-
-namespace WorldObjsData {
-class LiquidData;
-}
-
-namespace WorldObjs {
-
-class Liquid : public WorldObj
-{
-private:
- Sprite sur;
-
- Vector3f pos;
-
- /** Cause to interpret the width in pixels instead of tiles */
- bool old_width_handling;
-
- int width;
-
- /** Number of miliseconds between frames */
- int speed;
-
-public:
- Liquid(const FileReader& reader);
-
- float get_z_pos () const;
- void on_startup();
- void draw (SceneContext& gc);
- void update();
-
-private:
- Liquid (const Liquid&);
- Liquid& operator= (const Liquid&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
-
Copied: branches/pingus_sdl/src/worldobjs/rain_generator.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/rain_generator.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/rain_generator.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/rain_generator.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/rain_generator.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,77 +0,0 @@
-// $Id: rain_generator.cxx,v 1.13 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../particles/rain_particle_holder.hxx"
-#include "../sound/sound.hxx"
-#include "../world.hxx"
-#include "../display/scene_context.hxx"
-#include "rain_generator.hxx"
-
-namespace WorldObjs {
-
-RainGenerator::RainGenerator (const FileReader& reader)
- : do_thunder (false),
- thunder_count (0)
-{
-}
-
-RainGenerator::~RainGenerator ()
-{
-}
-
-void
-RainGenerator::draw (SceneContext& gc)
-{
- if (do_thunder)
- {
- if (thunder_count < 0.0f) {
- do_thunder = false;
- thunder_count = 0.0f;
- waiter_count = 1.0f;
- }
-
- gc.color().fill_screen(Color(255, 255, 255,
static_cast<int>(thunder_count*255)));
- }
-}
-
-void
-RainGenerator::update()
-{
- if (waiter_count < 0.0f && rand () % 150 == 0)
- {
- std::cout << "Doing thunder" << std::endl;
- do_thunder = true;
- thunder_count = 1.0f;
- waiter_count = 1.0f;
- Sound::PingusSound::play_sound ("sounds/thunder.wav");
- }
-
- if (do_thunder)
- thunder_count -= 10.0f * 0.025f;
-
- waiter_count -= 20.0f * 0.025f;
-
- for (int i=0; i < 16; ++i)
- world->get_rain_particle_holder()->add_particle(rand() %
(world->get_width() * 2), -32);
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/rain_generator.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/rain_generator.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/rain_generator.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/rain_generator.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/rain_generator.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,50 +0,0 @@
-// $Id: rain_generator.hxx,v 1.8 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PARTICLES_RAIN_GENERATOR_HXX
-#define HEADER_PINGUS_PARTICLES_RAIN_GENERATOR_HXX
-
-#include "../worldobj.hxx"
-
-namespace WorldObjs {
-
-class RainGenerator : public WorldObj
-{
-private:
- bool do_thunder;
- float thunder_count;
- float waiter_count;
-public:
- RainGenerator(const FileReader& reader);
- ~RainGenerator();
-
- void update ();
- void draw (SceneContext& gc);
- float get_z_pos () const { return 1000; }
-
-private:
- RainGenerator (const RainGenerator&);
- RainGenerator& operator= (const RainGenerator&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/smasher.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/smasher.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/smasher.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/smasher.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/smasher.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,150 +0,0 @@
-// $Id: smasher.cxx,v 1.23 2003/10/21 21:37:06 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../math.hxx"
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../particles/smoke_particle_holder.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../resource.hxx"
-#include "../sound/sound.hxx"
-#include "../world.hxx"
-#include "smasher.hxx"
-
-namespace WorldObjs {
-
-Smasher::Smasher(const FileReader& reader)
- : surface(Resource::load_sprite("traps/smasher")),
- smashing(false),
- downwards(false),
- count(0)
-{
- reader.read_vector("position", pos);
-}
-
-float
-Smasher::get_z_pos () const
-{
- return pos.z;
-}
-
-void
-Smasher::update ()
-{
-
- PinguHolder* holder = world->get_pingus();
- for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu)
- catch_pingu(*pingu);
-
- if (smashing)
- {
- if (downwards)
- {
- if (count >= 5)
- {
- // SMASH!!! The thing hitten earth and kills the pingus
- downwards = false;
- --count;
- Sound::PingusSound::play_sound("sounds/tenton.wav", 0.7f);
-
- for(int i=0; i < 20; ++i)
- {
- world->get_smoke_particle_holder()->
- add_particle(pos.x + 20 + float(rand() % 260),
- pos.y + 180,
- float(Math::frand()-0.5f),
-
float(Math::frand()-0.5f));
- }
-
- for (PinguIter pingu = holder->begin (); pingu !=
holder->end (); ++pingu)
- {
- if ((*pingu)->is_inside(static_cast<int>(pos.x +
30),
- static_cast<int>(pos.y +
90),
- static_cast<int>(pos.x +
250),
- static_cast<int>(pos.y +
190)))
- {
- if ((*pingu)->get_action() !=
Actions::Splashed)
- (*pingu)->set_action(Actions::Splashed);
- }
- }
- }
- else
- {
- ++count;
- }
- }
- else
- {
- if (count <= 0)
- {
- count = 0;
- smashing = false;
- } else {
- --count;
- }
- }
- }
-}
-
-void
-Smasher::on_startup ()
-{
- std::cout << "Drawing colmap entry" << std::endl;
- CollisionMask buf = Resource::load_collision_mask("traps/smasher_cmap");
- world->put(buf,
- static_cast<int>(pos.x),
- static_cast<int>(pos.y),
- Groundtype::GP_SOLID);
-}
-
-void
-Smasher::draw (SceneContext& gc)
-{
- gc.color().draw (surface, pos);
-}
-
-void
-Smasher::catch_pingu (Pingu* pingu)
-{
- // Activate the smasher if a Pingu is under it
- if (( pingu->direction.is_left()
- && pingu->get_pos().x > pos.x + 65
- && pingu->get_pos().x < pos.x + 85)
- ||
- ( pingu->direction.is_right()
- && pingu->get_pos().x > pos.x + 190
- && pingu->get_pos().x < pos.x + 210))
- {
- if (pingu->get_action() != Actions::Splashed)
- {
- if (!smashing)
- {
- count = 0;
- downwards = true;
- smashing = true;
- }
- }
- }
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/smasher.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/smasher.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/smasher.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/smasher.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/smasher.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,65 +0,0 @@
-// $Id: smasher.hxx,v 1.9 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_SMASHER_HXX
-#define HEADER_PINGUS_WORLDOBJS_SMASHER_HXX
-
-#include "../worldobj.hxx"
-
-
-namespace WorldObjsData {
-class SmasherData;
-}
-
-class Pingu;
-
-namespace WorldObjs {
-
-class Smasher : public WorldObj
-{
-private:
- Sprite surface;
- Vector3f pos;
-
- bool smashing;
- bool downwards;
- int count;
-
-public:
- Smasher(const FileReader& reader);
-
- float get_z_pos () const;
-
- void draw (SceneContext& gc);
- void on_startup ();
- void update ();
-
-protected:
- void catch_pingu (Pingu* pingu);
-
-private:
- Smasher (const Smasher&);
- Smasher& operator= (const Smasher&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/snow_generator.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/snow_generator.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/snow_generator.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/snow_generator.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/snow_generator.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,75 +0,0 @@
-// $Id: snow_generator.cxx,v 1.9 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <math.h>
-#include <iostream>
-#include "../math.hxx"
-#include "../world.hxx"
-#include "../particles/snow_particle_holder.hxx"
-#include "snow_generator.hxx"
-
-namespace WorldObjs {
-
-SnowGenerator::SnowGenerator(const FileReader& reader)
-{
- intensity = 1.0f;
- reader.read_float("intensity", intensity);
-}
-
-SnowGenerator::~SnowGenerator()
-{
-}
-
-void
-SnowGenerator::update()
-{
- for(int i = 0; i < floor(intensity); ++i)
- {
- if (rand() % 3 != 0)
- world->get_snow_particle_holder()->add_particle(rand() %
world->get_width(), -32, false);
- else
- world->get_snow_particle_holder()->add_particle(rand() %
world->get_width(), -32, true);
- }
-
- if ((intensity - (int)intensity) > Math::frand())
- {
- if (rand() % 3 != 0)
- world->get_snow_particle_holder()->add_particle(rand() %
world->get_width(), -32, false);
- else
- world->get_snow_particle_holder()->add_particle(rand() %
world->get_width(), -32, true);
- }
-}
-
-void
-SnowGenerator::on_startup()
-{
- // FIXME: if snow should be available from start, this needs to get fixed to
have the right amount of snow
-#if 0
- for (int i = 0; i < 500; ++i) // FIXME: 500 is a random value, doesn't work
very often
- {
- world->get_snow_particle_holder()->add_particle(rand() %
world->get_width(), rand() % world->get_height());
- world->get_snow_particle_holder()->add_particle(rand() %
world->get_width(), rand() % world->get_height());
- world->get_snow_particle_holder()->add_particle(rand() %
world->get_width(), rand() % world->get_height(), true);
- }
-#endif
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/snow_generator.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/snow_generator.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/snow_generator.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/snow_generator.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/snow_generator.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,54 +0,0 @@
-// $Id: snow_generator.hxx,v 1.8 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_PARTICLES_SNOW_GENERATOR_HXX
-#define HEADER_PINGUS_PARTICLES_SNOW_GENERATOR_HXX
-
-#include "../worldobj.hxx"
-
-
-namespace WorldObjsData {
-class SnowGeneratorData;
-}
-
-namespace WorldObjs {
-
-class SnowGenerator : public WorldObj
-{
-private:
- float intensity;
-public:
- SnowGenerator(const FileReader& reader);
- ~SnowGenerator ();
-
- /** fill the screen with snow flocks */
- void on_startup();
- void draw(SceneContext&) {}
- void update();
- float get_z_pos() const { return 1000; }
-private:
- SnowGenerator (const SnowGenerator&);
- SnowGenerator& operator= (const SnowGenerator&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/solid_color_background.cpp (from rev
2685, branches/pingus_sdl/src/worldobjs/solid_color_background.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/solid_color_background.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/solid_color_background.cxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/solid_color_background.cxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,40 +0,0 @@
-// $Id: solid_color_background.cxx,v 1.7 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../gui/display.hxx"
-#include "../display/scene_context.hxx"
-#include "solid_color_background.hxx"
-
-namespace WorldObjs {
-
-SolidColorBackground::SolidColorBackground(const FileReader& reader)
-{
- reader.read_color("color", color);
-}
-
-void
-SolidColorBackground::draw (SceneContext& gc)
-{
- // FIXME: should use SceneContext, not CL_Display
- gc.color().fill_screen(color);
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/solid_color_background.hpp (from rev
2685, branches/pingus_sdl/src/worldobjs/solid_color_background.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/solid_color_background.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/solid_color_background.hxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/solid_color_background.hxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,56 +0,0 @@
-// $Id: solid_color_background.hxx,v 1.7 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_SOLID_COLOR_BACKGROUND_HXX
-#define HEADER_PINGUS_WORLDOBJS_SOLID_COLOR_BACKGROUND_HXX
-
-#include "../math/color.hpp"
-#include "../pixel_buffer.hpp"
-#include "../worldobj.hxx"
-
-namespace WorldObjsData {
-class SolidColorBackgroundData;
-}
-
-namespace WorldObjs {
-
-class SolidColorBackground : public WorldObj
-{
-private:
- Color color;
-
-public:
- SolidColorBackground(const FileReader& reader);
-
- // FIXME: Make z_position editable
- float get_z_pos () const { return -10; }
- void update () {}
-
- void draw (SceneContext& gc);
-
-private:
- SolidColorBackground (const SolidColorBackground&);
- SolidColorBackground& operator= (const SolidColorBackground&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/spike.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/spike.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/spike.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/spike.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldobjs/spike.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,88 +0,0 @@
-// $Id: spike.cxx,v 1.12 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../world.hxx"
-#include "../resource.hxx"
-#include "spike.hxx"
-
-namespace WorldObjs {
-
-Spike::Spike (const FileReader& reader)
- : surface(Resource::load_sprite("traps/spike")),
- killing(false)
-{
- reader.read_vector("position", pos);
-}
-
-float
-Spike::get_z_pos () const
-{
- return pos.z;
-}
-
-void
-Spike::draw (SceneContext& gc)
-{
- if (killing) {
- gc.color().draw (surface, pos);
- } else {
- // do nothing
- }
-}
-
-void
-Spike::update()
-{
- if (killing)
- surface.update();
-
- PinguHolder* holder = world->get_pingus();
- for (PinguIter pingu = holder->begin (); pingu != holder->end ();
++pingu)
- catch_pingu(*pingu);
-
- if (surface.get_current_frame() == surface.get_frame_count() - 1)
- killing = false;
-}
-
-void
-Spike::catch_pingu (Pingu* pingu)
-{
- if (!killing) {
- if ( pingu->get_pos().x > pos.x + 16 - 5 && pingu->get_pos().x
< pos.x + 16 + 5
- && pingu->get_pos().y > pos.y &&
pingu->get_pos().y < pos.y + 32)
- {
- surface.restart();
- killing = true;
- }
- } else {
- if (surface.get_current_frame() == 3
- && pingu->get_pos().x > pos.x +16 - 12 &&
pingu->get_pos().x < pos.x + 16 + 12
- && pingu->get_pos().y > pos.y &&
pingu->get_pos().y < pos.y + 32)
- {
- pingu->set_status(PS_DEAD);
- }
- }
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/spike.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/spike.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/spike.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/spike.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/worldobjs/spike.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,61 +0,0 @@
-// $Id: spike.hxx,v 1.7 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_TRAPS_SPIKE_HXX
-#define HEADER_PINGUS_TRAPS_SPIKE_HXX
-
-#include "../worldobj.hxx"
-
-
-namespace WorldObjsData {
-class SpikeData;
-} // namespace WorldObjsData
-
-class Pingu;
-
-namespace WorldObjs {
-
-class Spike : public WorldObj
-{
-private:
- Sprite surface;
- Vector3f pos;
- bool killing;
-
-public:
- Spike(const FileReader& reader);
-
- float get_z_pos () const;
-
- void draw (SceneContext& gc);
- void update ();
-
-protected:
- void catch_pingu (Pingu*);
-
-private:
- Spike (const Spike&);
- Spike& operator= (const Spike&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/starfield_background.cpp (from rev
2685, branches/pingus_sdl/src/worldobjs/starfield_background.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/starfield_background.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/starfield_background.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/starfield_background.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,75 +0,0 @@
-// $Id: starfield_background.cxx,v 1.7 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "starfield_background.hxx"
-#include "starfield_background_stars.hxx"
-
-namespace WorldObjs {
-
-StarfieldBackground::StarfieldBackground(const FileReader& reader)
-{
- small_stars_count = 100;
- middle_stars_count = 50;
- large_stars_count = 25;
-
- reader.read_int("small-stars", small_stars_count);
- reader.read_int("middle-stars", middle_stars_count);
- reader.read_int("large-stars", large_stars_count);
-
- for (int i=0; i < small_stars_count; ++i)
- stars.push_back(new
StarfieldBackgroundStars(StarfieldBackgroundStars::SMALL_STAR));
-
- for (int i=0; i < middle_stars_count; ++i)
- stars.push_back(new
StarfieldBackgroundStars(StarfieldBackgroundStars::MIDDLE_STAR));
-
- for (int i=0; i < large_stars_count; ++i)
- stars.push_back(new
StarfieldBackgroundStars(StarfieldBackgroundStars::LARGE_STAR));
-}
-
-StarfieldBackground::~StarfieldBackground ()
-{
- for (unsigned int i = 0; i < stars.size(); ++i)
- delete stars[i];
-}
-
-
-void
-StarfieldBackground::update ()
-{
- for (std::vector<StarfieldBackgroundStars*>::iterator i = stars.begin();
- i != stars.end(); ++i)
- {
- (*i)->update ();
- }
-}
-
-void
-StarfieldBackground::draw (SceneContext& gc)
-{
- for (std::vector<StarfieldBackgroundStars*>::iterator i = stars.begin();
- i != stars.end(); ++i)
- {
- (*i)->draw (gc);
- }
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/starfield_background.hpp (from rev
2685, branches/pingus_sdl/src/worldobjs/starfield_background.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/starfield_background.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/starfield_background.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/starfield_background.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,63 +0,0 @@
-// $Id: starfield_background.hxx,v 1.8 2003/10/18 23:17:28 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOJBS_STARFIELD_BACKGROUND_HXX
-#define HEADER_PINGUS_WORLDOBJS_STARFIELD_BACKGROUND_HXX
-
-#include <vector>
-#include "../worldobj.hxx"
-
-
-namespace WorldObjsData {
-class StarfieldBackgroundData;
-}
-
-namespace WorldObjs {
-
-class StarfieldBackgroundStars;
-
-class StarfieldBackground : public WorldObj
-{
-private:
- int small_stars_count;
- int middle_stars_count;
- int large_stars_count;
-
- std::vector<StarfieldBackgroundStars*> stars;
-
-public:
- StarfieldBackground(const FileReader& reader);
- ~StarfieldBackground();
-
- // FIXME: Make z_pos handling editable via xml
- float get_z_pos() const { return -10; }
-
- void update ();
- void draw (SceneContext& gc);
-
-private:
- StarfieldBackground (const StarfieldBackground&);
- StarfieldBackground& operator= (const StarfieldBackground&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/starfield_background_stars.cpp (from
rev 2685, branches/pingus_sdl/src/worldobjs/starfield_background_stars.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/starfield_background_stars.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/starfield_background_stars.cxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/starfield_background_stars.cxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,70 +0,0 @@
-// $Id: starfield_background_stars.cxx,v 1.10 2003/10/20 13:11:09 grumbel Exp
$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../display/scene_context.hxx"
-#include "../world.hxx"
-#include "../resource.hxx"
-#include "starfield_background_stars.hxx"
-
-namespace WorldObjs {
-
-StarfieldBackgroundStars::StarfieldBackgroundStars (Type type)
-{
- switch (type)
- {
- case SMALL_STAR:
- sur = Resource::load_sprite("game/stars/small_star");
- break;
- case MIDDLE_STAR:
- sur = Resource::load_sprite("game/stars/middle_star");
- break;
- case LARGE_STAR:
- sur = Resource::load_sprite("game/stars/large_star");
- break;
- }
-
- x_pos = float(rand() % WorldObj::get_world()->get_width());
- y_pos = float(rand() % WorldObj::get_world()->get_height());
-
- x_add = rand() % 5 + 1.0f;
- y_add = 0.0f;
-}
-
-void
-StarfieldBackgroundStars::update ()
-{
- x_pos += x_add;
- y_pos += y_add;
-
- if (x_pos > WorldObj::get_world()->get_width())
- {
- x_pos = -32;
- y_pos = float(rand() % WorldObj::get_world()->get_height());
- }
-}
-
-void
-StarfieldBackgroundStars::draw (SceneContext& gc)
-{
- gc.color().draw(sur, Vector3f (x_pos, y_pos));
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/starfield_background_stars.hpp (from
rev 2685, branches/pingus_sdl/src/worldobjs/starfield_background_stars.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/starfield_background_stars.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/starfield_background_stars.hxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/starfield_background_stars.hxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,61 +0,0 @@
-// $Id: starfield_background_stars.hxx,v 1.9 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_STARFIELD_BACKGROUND_STARS_HXX
-#define HEADER_PINGUS_WORLDOBJS_STARFIELD_BACKGROUND_STARS_HXX
-
-#include "../worldobj.hxx"
-#include "../sprite.hpp"
-
-namespace WorldObjs {
-
-class StarfieldBackgroundStars
-{
-private:
- Sprite sur;
-
- float x_pos;
- float y_pos;
-
- float x_add;
- float y_add;
-
-public:
- enum Type { SMALL_STAR, MIDDLE_STAR, LARGE_STAR };
-
- StarfieldBackgroundStars () {}
- StarfieldBackgroundStars (Type type);
-
- // Never used
- float get_z_pos () const { return -100; }
-
- void init ();
- void update ();
- void draw (SceneContext& gc);
-
-private:
- StarfieldBackgroundStars (const StarfieldBackgroundStars&);
- StarfieldBackgroundStars& operator= (const StarfieldBackgroundStars&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/surface_background.cpp (from rev
2685, branches/pingus_sdl/src/worldobjs/surface_background.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/surface_background.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/surface_background.cxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/surface_background.cxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,203 +0,0 @@
-// $Id: surface_background.cxx,v 1.14 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../display/scene_context.hxx"
-#include "../world.hxx"
-#include "../timer.hxx"
-#include "../resource.hxx"
-#include "../globals.hxx"
-#include "../blitter.hxx"
-#include "../gui/display.hxx"
-#include "surface_background.hxx"
-
-namespace WorldObjs {
-
-SurfaceBackground::SurfaceBackground(const FileReader& reader)
- : para_x(0.5),
- para_y(0.5),
- scroll_x(0.0),
- scroll_y(0.0),
- color(0,0,0,0),
- stretch_x(false),
- stretch_y(false),
- keep_aspect(false),
- scroll_ox(0),
- scroll_oy(0)
-{
- reader.read_vector("position", pos);
-
- ResDescriptor desc;
-
- reader.read_desc("surface", desc);
- reader.read_color("color", color);
-
- reader.read_float("para-x", para_x);
- reader.read_float("para-y", para_y);
-
- reader.read_float("scroll-x", scroll_x);
- reader.read_float("scroll-y", scroll_y);
-
- reader.read_bool("stretch-x", stretch_x);
- reader.read_bool("stretch-y", stretch_y);
-
- reader.read_bool("keep-aspect", keep_aspect);
-
-
- Timer timer("Background creation");
-
- if (color.a > 1.0)
- std::cout << "Background: Warning dim larger than 1.0 are no longer
supported" << std::endl;
-
-#if 0
- PixelBuffer canvas = Resource::load_pixelbuffer(desc);
-
- // Scaling Code
- if (stretch_x && stretch_y)
- {
- canvas = Blitter::scale_surface_to_canvas(canvas, world->get_width(),
world->get_height());
- }
- else if (stretch_x && !stretch_y)
- {
- if (keep_aspect)
- {
- float aspect = canvas.get_height()/float(canvas.get_width());
- canvas = Blitter::scale_surface_to_canvas(canvas,
- world->get_width(),
-
int(world->get_width()*aspect));
- }
- else
- {
- canvas = Blitter::scale_surface_to_canvas(canvas,
canvas.get_width(), world->get_height());
- }
- }
- else if (!stretch_x && stretch_y)
- {
- if (keep_aspect)
- {
- float aspect = float(canvas.get_width())/canvas.get_height();
- canvas = Blitter::scale_surface_to_canvas(canvas,
- int(world->get_height() *
aspect),
- world->get_height());
- }
- else
- {
- canvas = Blitter::scale_surface_to_canvas(canvas,
canvas.get_width(), world->get_height());
- }
- }
-
- SpriteDescription sprite_desc;
- sprite_desc.add_frame(canvas);
- bg_surface = Sprite(sprite_desc);
-#else
- bg_surface = Resource::load_sprite(desc);
-#endif
-
- timer.stop();
-}
-
-float
-SurfaceBackground::get_z_pos () const
-{
- return pos.z;
-}
-
-void
-SurfaceBackground::update()
-{
- if (!bg_surface)
- return;
-
- if (scroll_x)
- {
- scroll_ox += scroll_x;
-
- if (scroll_ox > bg_surface.get_width())
- scroll_ox -= bg_surface.get_width();
- else if (-scroll_ox > bg_surface.get_width())
- scroll_ox += bg_surface.get_width();
- }
-
- if (scroll_y)
- {
- scroll_oy += scroll_y;
-
- if (scroll_oy > bg_surface.get_height())
- scroll_oy -= bg_surface.get_height();
- else if (-scroll_oy > bg_surface.get_height())
- scroll_oy += bg_surface.get_height();
- }
-}
-
-void
-SurfaceBackground::draw (SceneContext& gc)
-{
- if (!bg_surface)
- return;
-
- if (fast_mode)
- {
- Display::clear();
- }
- else
- {
- if (render_preview)
- {
-#if 0 // FIXME:
- for(int y = 0; y < gc.get_height(); y += bg_surface.get_height())
- for(int x = 0; x < gc.get_width(); x += bg_surface.get_width())
- gc.color().draw(bg_surface, Vector3f(x, y));
-#endif
- }
- else
- {
- int x_of = gc.color().get_clip_rect().left;
- int y_of = gc.color().get_clip_rect().top;
-
- int start_x;
- int start_y;
-
- start_x = static_cast<int>((x_of * para_x) + scroll_ox);
- start_y = static_cast<int>((y_of * para_y) + scroll_oy);
-
- while (start_x > 0)
- start_x -= bg_surface.get_width();
-
- while (start_y > 0)
- start_y -= bg_surface.get_height();
-
- for(int y = start_y;
- y < world->get_height();
- y += bg_surface.get_height())
- {
- for(int x = start_x;
- x < world->get_width();
- x += bg_surface.get_width())
- {
- gc.color().draw(bg_surface, Vector3f(static_cast<float>(x),
- static_cast<float>(y),
pos.z));
- }
- }
- }
- }
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/surface_background.hpp (from rev
2685, branches/pingus_sdl/src/worldobjs/surface_background.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/surface_background.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/surface_background.hxx 2007-01-18
02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/surface_background.hxx 2007-01-18
03:08:17 UTC (rev 2686)
@@ -1,89 +0,0 @@
-// $Id: surface_background.hxx,v 1.8 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_SURFACE_BACKGROUND_HXX
-#define HEADER_PINGUS_WORLDOBJS_SURFACE_BACKGROUND_HXX
-
-#include "../res_descriptor.hxx"
-#include "../worldobj.hxx"
-
-namespace WorldObjsData {
-class SurfaceBackgroundData;
-}
-
-namespace WorldObjs {
-
-class SurfaceBackground : public WorldObj
-{
-private:
- float para_x;
- float para_y;
-
- /** Position of the background, only the z_pos is really used. */
- Vector3f pos;
-
- /** The amount of pixel the background is scrolled each frame in x
- direction. */
- float scroll_x;
-
- /** The amount of pixel the background is scrolled each frame in x
- direction. */
- float scroll_y;
-
- /** fill_rect() components
- An fill_rect() can be drawn over the background, the following
- for components are passed to the fill_rect() call. */
- Color color;
-
- /** Stretch the background to the full screen size in x direction */
- bool stretch_x;
-
- /** Stretch the background to the full screen size in x direction */
- bool stretch_y;
-
- /** If streched in x or y direction keep the aspect ratio */
- bool keep_aspect;
-
- /** Background image */
- Sprite bg_surface;
-
- /** The horizontal scrolling speed in pixels per tick */
- float scroll_ox;
-
- /** The vertical scrolling speed in pixels per tick */
- float scroll_oy;
-
-public:
- SurfaceBackground(const FileReader& reader);
-
- float get_z_pos () const;
-
- void update ();
- void draw (SceneContext& gc);
-
-private:
- SurfaceBackground (const SurfaceBackground&);
- SurfaceBackground& operator= (const SurfaceBackground&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/switch_door.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/switch_door.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/switch_door.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/switch_door.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/switch_door.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,127 +0,0 @@
-// $Id: switch_door.cxx,v 1.28 2003/10/21 11:01:52 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../col_map.hxx"
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../world.hxx"
-#include "../resource.hxx"
-#include "switch_door.hxx"
-
-namespace WorldObjs {
-
-SwitchDoor::SwitchDoor(const FileReader& reader)
- : door_box (Resource::load_sprite("worldobjs/switchdoor_box")),
- door_tile (Resource::load_sprite("worldobjs/switchdoor_tile")),
-
door_tile_cmap(Resource::load_collision_mask("worldobjs/switchdoor_tile_cmap")),
- switch_sur (Resource::load_sprite("worldobjs/switchdoor_switch")),
- is_opening(false)
-{
- FileReader subreader;
- reader.read_section("switch", subreader);
- subreader.read_vector("position", switch_pos);
-
- reader.read_section("door", subreader);
- subreader.read_vector("position", door_pos);
- subreader.read_int("height", door_height);
-
- current_door_height = door_height;
-}
-
-void
-SwitchDoor::on_startup ()
-{
-#if 0
- world->get_colmap()->put(door_box.get_frame_pixeldata(0),
- static_cast<int>(door_pos.x),
- static_cast<int>(door_pos.y),
- Groundtype::GP_SOLID);
-
- for (int i=0; i < door_height; ++i)
- world->get_colmap()->put(door_tile_cmap,
- static_cast<int>(door_pos.x),
- static_cast<int>(door_pos.y)
- + i * door_tile.get_height()
- + door_box.get_height(),
- Groundtype::GP_SOLID);
-#endif
-}
-
-void
-SwitchDoor::draw (SceneContext& gc)
-{
- gc.color().draw (door_box, door_pos);
- for (int i=0; i < current_door_height; ++i)
- gc.color().draw(door_tile, Vector3f(door_pos.x,
- door_pos.y + i * door_tile.get_height() +
door_box.get_height()));
-
- gc.color().draw(switch_sur, switch_pos);
-}
-
-void
-SwitchDoor::update ()
-{
- if (current_door_height > 0)
- {
- if (!is_opening)
- {
- // Check if a pingu is passing the switch
- PinguHolder* holder = world->get_pingus();
-
- for (PinguIter pingu = holder->begin (); pingu !=
holder->end (); ++pingu)
- {
- if ( (*pingu)->get_pos().x > switch_pos.x
- && (*pingu)->get_pos().x < switch_pos.x
+ switch_sur.get_width()
- && (*pingu)->get_pos().y > switch_pos.y
- && (*pingu)->get_pos().y < switch_pos.y
+ switch_sur.get_height())
- {
- is_opening = true;
- }
- }
- }
- else
- {
- // Open the door
- --current_door_height;
-
- // If the door is opend enough, so that a pingus fits
under
- // it, we remove the door from the colmap
- if (current_door_height + 10 < door_height)
- {
-#if 0
-
world->get_colmap()->put(door_box.get_frame_pixeldata(0),
- static_cast<int>(door_pos.x),
- static_cast<int>(door_pos.y),
- Groundtype::GP_NOTHING);
- for (int i=0; i < door_height; ++i)
- world->get_colmap()->put(door_tile_cmap,
- static_cast<int>(door_pos.x),
- static_cast<int>(door_pos.y) + i *
door_tile.get_height()
- + door_box.get_height(),
- Groundtype::GP_NOTHING);
-#endif
- }
- }
- }
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/switch_door.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/switch_door.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/switch_door.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/switch_door.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/switch_door.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,76 +0,0 @@
-// $Id: switch_door.hxx,v 1.22 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_SWITCH_DOOR_HXX
-#define HEADER_PINGUS_WORLDOBJS_SWITCH_DOOR_HXX
-
-#include "../worldobj.hxx"
-
-namespace WorldObjsData {
-class SwitchDoorData;
-} // namespace WorldObjsData
-
-namespace WorldObjs {
-
-/** A door and a switch, if a pingu is passing the switch, the door
- will open. */
-class SwitchDoor : public WorldObj
-{
-private:
- /// The upper/middle pos of the door
- Vector3f door_pos;
-
- /// The bottom/middle pos of the switch
- Vector3f switch_pos;
-
- // The height of the door in graphic tiles
- int door_height;
-
- Sprite door_box;
- Sprite door_tile;
- CollisionMask door_tile_cmap;
- Sprite switch_sur;
-
- /** True if the door is opening */
- bool is_opening;
-
- /** The current height of the door, it might decrease when the door
- is opening, it will be zero when the door is fully opened */
- int current_door_height;
-
-public:
- SwitchDoor(const FileReader& reader);
-
- void on_startup();
- void draw (SceneContext& gc);
- void update ();
-
- /// The switch and the door should stay above the pingus
- float get_z_pos() const { return 100; }
-
-private:
- SwitchDoor (const SwitchDoor&);
- SwitchDoor& operator= (const SwitchDoor&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/teleporter.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/teleporter.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/teleporter.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/teleporter.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/teleporter.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,76 +0,0 @@
-// $Id: teleporter.cxx,v 1.18 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "../display/scene_context.hxx"
-#include "../pingu.hxx"
-#include "../pingu_holder.hxx"
-#include "../world.hxx"
-#include "../resource.hxx"
-#include "teleporter.hxx"
-
-namespace WorldObjs {
-
-Teleporter::Teleporter(const FileReader& reader)
- : sprite(Resource::load_sprite("worldobjs/teleporter")),
- target_sprite(Resource::load_sprite("worldobjs/teleportertarget"))
-{
- FileReader subreader;
-
- reader.read_vector ("position", pos);
- reader.read_section ("target", subreader);
- subreader.read_vector("position", target_pos);
-}
-
-float
-Teleporter::get_z_pos () const
-{
- return pos.z;
-}
-
-void
-Teleporter::draw (SceneContext& gc)
-{
- gc.color().draw(sprite, pos);
- gc.color().draw(target_sprite, target_pos);
-}
-
-void
-Teleporter::update ()
-{
- sprite.update();
- target_sprite.update();
-
- PinguHolder* holder = world->get_pingus();
-
- for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu)
- {
- if ( (*pingu)->get_x() > pos.x - 3 && (*pingu)->get_x() < pos.x + 3
- && (*pingu)->get_y() > pos.y - 52 && (*pingu)->get_y() < pos.y)
- {
- (*pingu)->set_pos (target_pos.x, target_pos.y);
- sprite.restart();
- target_sprite.restart();
- }
- }
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/teleporter.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/teleporter.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/teleporter.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/teleporter.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/teleporter.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,56 +0,0 @@
-// $Id: teleporter.hxx,v 1.19 2003/10/19 12:25:47 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_TELEPORTER_HXX
-#define HEADER_PINGUS_WORLDOBJS_TELEPORTER_HXX
-
-#include "../worldobj.hxx"
-
-namespace WorldObjsData {
-class TeleporterData;
-}
-
-namespace WorldObjs {
-
-class Teleporter : public WorldObj
-{
-private:
- Vector3f pos;
- Vector3f target_pos;
-
- Sprite sprite;
- Sprite target_sprite;
-
-public:
- Teleporter(const FileReader& reader);
-
- void draw (SceneContext& gc);
- void update ();
- float get_z_pos () const;
-
-private:
- Teleporter (const Teleporter&);
- Teleporter& operator= (const Teleporter&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/thunderstorm_background.cpp (from rev
2685, branches/pingus_sdl/src/worldobjs/thunderstorm_background.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/thunderstorm_background.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/thunderstorm_background.cxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/thunderstorm_background.cxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,55 +0,0 @@
-// $Id: thunderstorm_background.cxx,v 1.7 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../resource.hxx"
-#include "../display/scene_context.hxx"
-#include "thunderstorm_background.hxx"
-
-namespace WorldObjs {
-
-ThunderstormBackground:: ThunderstormBackground(const FileReader& reader)
- : clouds_sur(Resource::load_sprite("textures/thunderstorm")),
- x_pos(0)
-{
- reader.read_vector("position", pos);
-}
-
-float
-ThunderstormBackground::get_z_pos () const
-{
- return pos.z;
-}
-
-void
-ThunderstormBackground::update ()
-{
- ++x_pos;
- if (x_pos >= static_cast<int>(clouds_sur.get_width()))
- x_pos = 0;
-}
-
-void
-ThunderstormBackground::draw (SceneContext& gc)
-{
- gc.color().draw(clouds_sur, Vector3f(x_pos, 0));
-}
-
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/thunderstorm_background.hpp (from rev
2685, branches/pingus_sdl/src/worldobjs/thunderstorm_background.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/thunderstorm_background.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/thunderstorm_background.hxx
2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/worldobjs/thunderstorm_background.hxx
2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,55 +0,0 @@
-// $Id: thunderstorm_background.hxx,v 1.10 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_THUNDERSTORM_BACKGROUND_HXX
-#define HEADER_PINGUS_WORLDOBJS_THUNDERSTORM_BACKGROUND_HXX
-
-#include "../worldobj.hxx"
-
-namespace WorldObjsData {
-class ThunderstormBackgroundData;
-}
-
-namespace WorldObjs {
-
-class ThunderstormBackground : public WorldObj
-{
-private:
- Vector3f pos;
- Sprite clouds_sur;
- int x_pos;
-
-public:
- ThunderstormBackground(const FileReader& reader);
-
- float get_z_pos () const;
-
- void update ();
- void draw (SceneContext& gc);
-
-private:
- ThunderstormBackground (const ThunderstormBackground&);
- ThunderstormBackground& operator= (const ThunderstormBackground&);
-};
-
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/woodthing.cpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/woodthing.cxx)
Deleted: branches/pingus_sdl/src/worldobjs/woodthing.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/woodthing.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/woodthing.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,67 +0,0 @@
-// $Id: woodthing.cxx,v 1.9 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../math.hxx"
-#include "../display/scene_context.hxx"
-#include "../particles/smoke_particle_holder.hxx"
-#include "../resource.hxx"
-#include "../world.hxx"
-#include "woodthing.hxx"
-
-namespace WorldObjs {
-// FIXME: Re-enable this namespace.
-// namespace Entrances {
-
-WoodThing::WoodThing(const FileReader& reader)
- : Entrance(reader)
-{
- surface = Resource::load_sprite("entrances/woodthing_mov");
- surface2 = Resource::load_sprite("entrances/woodthing_nmov");
-}
-
-void
-WoodThing::update ()
-{
- Entrance::update ();
-
- if (last_release > 0)
- surface.update();
-
- if (rand() % 5 == 0)
- {
- world->get_smoke_particle_holder()->
- add_particle(pos.x - surface.get_width () / 2 - 24,
- pos.y - surface.get_height() + 32 - 147,
- float(Math::frand() + 1) * -0.6f, float(Math::frand() +
1) * -0.6f);
- }
-}
-
-void
-WoodThing::draw (SceneContext& gc)
-{
- gc.color().draw(surface2, pos);
- // Only draw the animation if a pingu is coming out.
- if (last_release > 0)
- gc.color().draw(surface, pos);
-}
-
-// } // namespace Entrances
-} // namespace WorldObjs
-
-/* EOF */
Copied: branches/pingus_sdl/src/worldobjs/woodthing.hpp (from rev 2685,
branches/pingus_sdl/src/worldobjs/woodthing.hxx)
Deleted: branches/pingus_sdl/src/worldobjs/woodthing.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/woodthing.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/worldobjs/woodthing.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,50 +0,0 @@
-// $Id: woodthing.hxx,v 1.5 2003/10/20 13:11:09 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_WORLDOBJS_ENTRANCES_WOODTHING_HXX
-#define HEADER_PINGUS_WORLDOBJS_ENTRANCES_WOODTHING_HXX
-
-#include "entrance.hxx"
-
-namespace WorldObjs {
-// FIXME: Re-enable this namespace.
-//namespace Entrances {
-
-class WoodThing : public Entrance
-{
-private:
- Sprite surface2;
-
-public:
- WoodThing(const FileReader& reader);
-
- void update();
- void draw (SceneContext& gc);
-
-private:
- WoodThing (const WoodThing&);
- WoodThing& operator= (const WoodThing&);
-};
-
-//} // namespace Entrances
-} // namespace WorldObjs
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/xml_eval.cpp (from rev 2685,
branches/pingus_sdl/src/xml_eval.cxx)
Deleted: branches/pingus_sdl/src/xml_eval.cxx
===================================================================
--- branches/pingus_sdl/src/xml_eval.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/xml_eval.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,173 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <ClanLib/core.h>
-#include "xml_eval.hxx"
-
-namespace XMLEval {
-
-std::map<std::string, int> variables;
-std::map<std::string, CL_DomNode> functions;
-
-int lookup(const std::string& name)
-{
- int value = 0;
-
- if (CL_String::from(name, value))
- {
- return value;
- }
- else
- {
- std::map<std::string, int>::iterator i = variables.find(name);
-
- if (i != variables.end())
- {
- return i->second;
- }
- std::cout << "Error: No variable named: '" << name << "'" << std::endl;
- return 0;
- }
-}
-
-void eval_block(CL_DomNode child)
-{
- while(!child.is_null())
- {
- if (child.is_element())
- eval(child);
-
- child = child.get_next_sibling();
- }
-}
-
-void eval(const CL_DomNode& cur)
-{
- CL_DomElement el = cur.to_element();
-
- if (cur.is_element())
- {
- if (cur.get_node_name() == "for")
- {
- std::string var = el.get_attribute("name");
-
- for(int i = lookup(el.get_attribute("start"));
- i <= lookup(el.get_attribute("end")); ++i)
- {
- variables[var] = i;
- eval_block(cur.get_first_child());
- }
- }
- else if (cur.get_node_name() == "newline")
- {
- std::cout << std::endl;
- }
- else if (cur.get_node_name() == "printvar")
- {
- std::cout << lookup(el.get_attribute("var")) << std::flush;
- }
- else if (cur.get_node_name() == "print")
- {
- std::cout << el.get_attribute("string") << std::flush;
- }
- else if (cur.get_node_name() == "foobar")
- {
- std::cout << "Foobar" << std::endl;
- }
- else if (cur.get_node_name() == "block")
- {
- eval_block(cur.get_first_child());
- }
- else if (cur.get_node_name() == "set")
- {
- variables[el.get_attribute("name")] =
lookup(el.get_attribute("var"));
- }
- else if (cur.get_node_name() == "function")
- {
- functions[el.get_attribute("name")] = el.get_first_child();
- }
- else if (cur.get_node_name() == "modulo")
- {
- variables[el.get_attribute("name")]
- = lookup(el.get_attribute("name")) %
lookup(el.get_attribute("var"));
- }
- else if (cur.get_node_name() == "add")
- {
- variables[el.get_attribute("name")]
- = lookup(el.get_attribute("name")) +
lookup(el.get_attribute("var"));
- }
- else if (cur.get_node_name() == "if-non-zero")
- {
- int var = lookup(el.get_attribute("var"));
- if (var != 0)
- eval_block(cur.get_first_child());
- }
- else if (cur.get_node_name() == "if-zero")
- {
- int var = lookup(el.get_attribute("var"));
- if (var == 0)
- eval_block(cur.get_first_child());
- }
- else if (cur.get_node_name() == "mult")
- {
- variables[el.get_attribute("name")]
- = lookup(el.get_attribute("name")) *
lookup(el.get_attribute("val"));
- }
- else if (cur.get_node_name() == "funcall")
- {
- eval_block(functions[el.get_attribute("name")]);
- }
- else
- {
- std::cout << "Unknown command: " << cur.get_node_name() << std::endl;
- }
- }
- else
- {
- std::cout << "Unknown thingy" << std::endl;
- }
-}
-
-} // namespace XMLEval
-
-int main(int argc, char** argv)
-{
- try {
- CL_SetupCore::init();
-
- std::string filename = "test.xml";
-
- if (argc > 1)
- filename = argv[1];
-
- CL_DomDocument dom(new CL_InputSource_File(filename), true);
-
- CL_DomNode cur = dom.get_document_element();
-
- XMLEval::eval(cur);
-
- CL_SetupCore::deinit();
- } catch (CL_Error& err) {
- std::cout << "CL_Error: " << err.message << std::endl;
- }
- return 0;
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/xml_eval.hpp (from rev 2685,
branches/pingus_sdl/src/xml_eval.hxx)
Deleted: branches/pingus_sdl/src/xml_eval.hxx
===================================================================
--- branches/pingus_sdl/src/xml_eval.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/xml_eval.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,33 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_XML_EVAL_HXX
-#define HEADER_XML_EVAL_HXX
-
-namespace XMLEval {
-
-void eval(const CL_DomNode& cur);
-void eval_block(CL_DomNode cur);
-int lookup(const std::string& name);
-
-} // namespace XMLEval
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/xml_file_reader.cpp (from rev 2685,
branches/pingus_sdl/src/xml_file_reader.cxx)
Deleted: branches/pingus_sdl/src/xml_file_reader.cxx
===================================================================
--- branches/pingus_sdl/src/xml_file_reader.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/xml_file_reader.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,213 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <ClanLib/Display/color.h>
-#include <ClanLib/Core/Math/size.h>
-#include <ClanLib/Core/XML/dom_element.h>
-#include <ClanLib/Core/XML/dom_node_list.h>
-#include <ClanLib/Core/XML/dom_named_node_map.h>
-#include <ClanLib/Core/System/clanstring.h>
-#include "file_reader_impl.hxx"
-#include "vector.hxx"
-#include "res_descriptor.hxx"
-#include "resource_modifier.hxx"
-////#include "xml_file_reader.hxx"
-
-
-class XMLFileReaderImpl : public FileReaderImpl
-{
-private:
- CL_DomElement root;
- CL_DomNodeList childs;
-
- CL_DomElement get_node_by_name(const char* name) const
- {
- for(int i = 0; i < childs.get_length(); ++i)
- {
- if (childs.item(i).is_element())
- {
- if (childs.item(i).to_element().get_tag_name() == name)
- {
- return childs.item(i).to_element();
- }
- }
- }
- return CL_DomElement();
- }
-public:
-
- XMLFileReaderImpl(CL_DomElement element)
- : root(element),
- childs(root.get_child_nodes())
- {
- }
-
- std::string get_name() const
- {
- return root.get_tag_name();
- }
-
- bool read_int(const char* name, int& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- return !node.is_null() &&
CL_String::from(node.get_first_child().get_node_value(), value);
- }
-
- bool read_float (const char* name, float& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- return !node.is_null() &&
CL_String::from(node.get_first_child().get_node_value(), value);
- }
-
- bool read_bool (const char* name, bool& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- return !node.is_null() &&
CL_String::from(node.get_first_child().get_node_value(), value);
- }
-
- bool read_string(const char* name, std::string& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (!node.is_null())
- {
- value = node.get_first_child().get_node_value();
- return true;
- }
- else
- {
- return false;
- }
- }
-
- bool read_vector(const char* name, Vector& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (node.is_element())
- {
- XMLFileReader reader(node.to_element());
- reader.read_float("x", value.x);
- reader.read_float("y", value.y);
- reader.read_float("z", value.z);
- return true;
- }
- else
- {
- return false;
- }
- }
-
- bool read_color(const char* name, Colorf& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (node.is_element())
- {
- XMLFileReader reader(node.to_element());
- reader.read_float("red", value.red);
- reader.read_float("green", value.green);
- reader.read_float("blue", value.blue);
- reader.read_float("alpha", value.alpha);
- return true;
- }
- else
- {
- return false;
- }
- }
-
- bool read_size(const char* name, CL_Size& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (node.is_element())
- {
- XMLFileReader reader(node.to_element());
- reader.read_int("width", value.width);
- reader.read_int("height", value.height);
- return true;
- }
- else
- {
- return false;
- }
- }
-
- bool read_desc(const char* name, ResDescriptor& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (!node.is_null())
- {
- using ResourceModifierNS::rs_from_string;
-
- XMLFileReader reader(node);
- reader.read_string("image", value.res_name);
- reader.read_enum ("modifier", value.modifier, rs_from_string);
-
- return true;
- }
- else
- {
- return false;
- }
-
- }
-
- bool read_section(const char* name, FileReader& value) const
- {
- CL_DomElement node = get_node_by_name(name);
- if (!node.is_null())
- {
- value = XMLFileReader(node);
- return true;
- }
- else
- {
- return false;
- }
- }
-
- std::vector<FileReader> get_sections() const
- {
- std::vector<FileReader> lst;
- for(int i = 0; i < childs.get_length(); ++i)
- {
- if (childs.item(i).is_element())
- lst.push_back(XMLFileReader(childs.item(i).to_element()));
- }
- return lst;
- }
-
- std::vector<std::string> get_section_names() const
- {
- std::vector<std::string> lst;
- for(int i = 0; i < childs.get_length(); ++i)
- {
- if (childs.item(i).is_element())
- lst.push_back(childs.item(i).to_element().get_tag_name());
- }
- return lst;
- }
-};
-
-XMLFileReader::XMLFileReader(CL_DomElement element)
- : FileReader(SharedPtr<FileReaderImpl>(new XMLFileReaderImpl(element)))
-{
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/xml_file_reader.hpp (from rev 2685,
branches/pingus_sdl/src/xml_file_reader.hxx)
Deleted: branches/pingus_sdl/src/xml_file_reader.hxx
===================================================================
--- branches/pingus_sdl/src/xml_file_reader.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/xml_file_reader.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,38 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_XML_FILE_READER_HXX
-#define HEADER_XML_FILE_READER_HXX
-
-#if 0
-#include <ClanLib/Core/XML/dom_element.h>
-#include "file_reader.hxx"
-
-/** */
-class XMLFileReader : public FileReader
-{
-public:
- XMLFileReader(CL_DomElement element);
-};
-#endif
-
-#endif
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/xml_file_writer.cpp (from rev 2685,
branches/pingus_sdl/src/xml_file_writer.cxx)
Deleted: branches/pingus_sdl/src/xml_file_writer.cxx
===================================================================
--- branches/pingus_sdl/src/xml_file_writer.cxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/xml_file_writer.cxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,129 +0,0 @@
-// $Id: xml_file_writer.cxx,v 1.6 2004/03/31 18:17:38 torangan Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include <map>
-#include "vector.hxx"
-///#include "xml_file_writer.hxx"
-
-
-XMLFileWriter::XMLFileWriter(std::ostream& out_)
- : out(&out_)
-{
- (*out) << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";
-}
-
-XMLFileWriter::~XMLFileWriter()
-{
-
-}
-
-void
-XMLFileWriter::begin_section (const char* name)
-{
- (*out) << "<" << name << ">\n";
- section_stack.push(name);
-}
-
-void
-XMLFileWriter::begin_section (const char* name, const char* attributes)
-{
- (*out) << "<" << name << " " << attributes << ">\n";
- section_stack.push(name);
-}
-
-void
-XMLFileWriter::end_section ()
-{
- const std::string& section_name = section_stack.top();
-
- (*out) << "</" << section_name << ">\n";
-
- section_stack.pop();
-}
-
-void
-XMLFileWriter::write_int (const char* name, int value)
-{
- (*out) << "<" << name << ">" << value << "</" << name << ">\n";
-}
-
-void
-XMLFileWriter::write_float (const char* name, float value)
-{
- (*out) << "<" << name << ">" << value << "</" << name << ">\n";
-}
-
-void
-XMLFileWriter::write_color (const char* name, const Color& color)
-{
- (*out) << "<" << name << ">\n"
- << " <red>" << int(color.r * 255) << "</red>\n"
- << " <green>" << int(color.g * 255) << "</green>\n"
- << " <blue>" << int(color.b * 255) << "</blue>\n"
- << " <alpha>" << int(color.a * 255) << "</alpha>\n"
- << "</" << name << ">"
- << std::endl;
-}
-
-void
-XMLFileWriter::write_bool (const char* name, bool value)
-{
- (*out) << "<" << name << ">" << value << "</" << name << ">\n";
-}
-
-void
-XMLFileWriter::write_string (const char* name, const std::string& value)
-{
- // Perform basic XML encoding (turns apostrophes into ', etc.
- std::string new_value = value;
- std::string::size_type pos;
-
- std::map<std::string, std::string> replacements;
-
- replacements["&"] = "&";
- replacements["\""] = """;
- replacements["\'"] = "'";
- replacements["<"] = "<";
- replacements[">"] = ">";
-
- for (std::map<std::string, std::string>::iterator i =
replacements.begin();
- i != replacements.end(); i++)
- {
- for (pos = new_value.find(i->first); pos != std::string::npos;
pos = new_value.find(i->first))
- {
- // Replace character with encoding characters
- new_value.replace(pos, 1, i->second);
- }
- }
-
- (*out) << "<" << name << ">" << new_value << "</" << name << ">\n";
-}
-
-void
-XMLFileWriter::write_vector (const char* name, const Vector3f& value)
-{
- (*out) << "<" << name << ">\n"
- << " <x>" << value.x << "</x>\n"
- << " <y>" << value.y << "</y>\n"
- << " <z>" << value.z << "</z>\n"
- << "</" << name << ">\n";
-}
-
-/* EOF */
Copied: branches/pingus_sdl/src/xml_file_writer.hpp (from rev 2685,
branches/pingus_sdl/src/xml_file_writer.hxx)
Deleted: branches/pingus_sdl/src/xml_file_writer.hxx
===================================================================
--- branches/pingus_sdl/src/xml_file_writer.hxx 2007-01-18 02:52:22 UTC (rev
2685)
+++ branches/pingus_sdl/src/xml_file_writer.hxx 2007-01-18 03:08:17 UTC (rev
2686)
@@ -1,67 +0,0 @@
-// $Id: xml_file_writer.hxx,v 1.6 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_XML_FILE_WRITER_HXX
-#define HEADER_XML_FILE_WRITER_HXX
-
-#include <stack>
-#include <iosfwd>
-#include "math/color.hpp"
-#include "file_writer.hxx"
-
-
-/** */
-class XMLFileWriter : public FileWriter
-{
-private:
- /** A reference to the output stream */
- std::ostream* out;
-
- std::stack<std::string> section_stack;
-
-public:
- XMLFileWriter(std::ostream& out_);
- virtual ~XMLFileWriter();
-
- void begin_section (const char* name);
- void begin_section (const char* name, const char* attributes);
- void end_section ();
-
- void write_int (const char* name, int);
- void write_float (const char* name, float);
- void write_bool (const char* name, bool);
- void write_color (const char* name, const Color&);
- void write_string (const char* name, const std::string&);
- void write_vector (const char* name, const Vector3f&);
-
- template<class E, class F>
- void write_enum (const char* name, E value, F enum2string)
- {
- (*out) << "<" << name << ">" << enum2string(value) << "</" << name <<
">\n";
- }
-
-private:
- XMLFileWriter (const XMLFileWriter&);
- XMLFileWriter& operator= (const XMLFileWriter&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/xml_pdf.cpp (from rev 2685,
branches/pingus_sdl/src/xml_pdf.cxx)
Deleted: branches/pingus_sdl/src/xml_pdf.cxx
===================================================================
--- branches/pingus_sdl/src/xml_pdf.cxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/xml_pdf.cxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,111 +0,0 @@
-// $Id: xml_pdf.cxx,v 1.10 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <algorithm>
-#include <iostream>
-#include <vector>
-#include <ClanLib/core.h>
-#include "pingus_error.hxx"
-#include "path_manager.hxx"
-#include "xml_pingus_level.hxx"
-////#include "xml_file_reader.hxx"
-#include "xml_pdf.hxx"
-
-
-XMLPDF::XMLPDF(const std::string& filename)
-{
- CL_InputSourceProvider_File provider(".");
- CL_DomDocument doc(provider.open_source(filename), true);
-
- CL_DomElement root = doc.get_document_element();
-
- if (root.get_tag_name() != "pingus-demo")
- {
- PingusError::raise("Error: " + filename + ": not a <pingus-demo> file");
- }
- else
- {
- XMLFileReader reader(root);
-
- reader.read_string ("level", levelname);
-
- FileReader events_reader;
- reader.read_section("events", events_reader);
- const std::vector<FileReader>& objects = events_reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = objects.begin();
- i != objects.end(); ++i)
- {
- events.push_back(ServerEvent(*i));
- }
- }
-
- std::reverse(events.begin(), events.end());
-
- if (levelname.empty())
- PingusError::raise("XMLPDF: No level given");
-
- plf = XMLPingusLevel(path_manager.complete("levels/" + levelname +
".pingus"),
- path_manager.complete("levels/" + levelname +
".pingus"));
-
- std::cout << "XXXXXXXXX Read Demo file: " << std::endl;
- write_xml(std::cout);
-}
-
-XMLPDF::~XMLPDF()
-{
-}
-
-void
-XMLPDF::write_xml(std::ostream& xml)
-{
- xml << "<pingus-demo>\n"
- << " <level>" << levelname << "</level>\n"
- << " <events>\n";
-
- for(std::vector<ServerEvent>::iterator i = events.begin();
- i != events.end();
- ++i)
- i->write_xml(xml);
-
- xml << " </events>\n";
-}
-
-/** @return a pointer to the level structure */
-PingusLevel
-XMLPDF::get_plf()
-{
- return plf;
-}
-
-/** @return the levelname */
-std::string
-XMLPDF::get_levelname()
-{
- return levelname;
-}
-
-/** Returns a reference to the events of this demo */
-std::vector<ServerEvent>
-XMLPDF::get_events()
-{
- return events;
-}
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/xml_pdf.hpp (from rev 2685,
branches/pingus_sdl/src/xml_pdf.hxx)
Deleted: branches/pingus_sdl/src/xml_pdf.hxx
===================================================================
--- branches/pingus_sdl/src/xml_pdf.hxx 2007-01-18 02:52:22 UTC (rev 2685)
+++ branches/pingus_sdl/src/xml_pdf.hxx 2007-01-18 03:08:17 UTC (rev 2686)
@@ -1,63 +0,0 @@
-// $Id: xml_pdf.hxx,v 1.4 2003/10/18 23:17:27 grumbel Exp $
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_XML_PDF_HXX
-#define HEADER_PINGUS_XML_PDF_HXX
-
-#include <string>
-#include <vector>
-#include <iosfwd>
-
-#include "pingus_level.hxx"
-#include "server_event.hxx"
-
-
-/** XMLPDF stands for Pingus Demo File, it contains all the infos
- necesarry to play a pingus demo recording */
-class XMLPDF
-{
-private:
- PingusLevel plf;
- std::string levelname;
- std::vector<ServerEvent> events;
-
-public:
- XMLPDF(const std::string& filename);
- ~XMLPDF();
-
- /** @return a pointer to the level structure */
- PingusLevel get_plf();
-
- /** @return the levelname */
- std::string get_levelname();
-
- /** Returns a reference to the events of this demo */
- std::vector<ServerEvent> get_events();
-
- void write_xml(std::ostream& xml);
-
-private:
- XMLPDF (const XMLPDF&);
- XMLPDF& operator= (const XMLPDF&);
-};
-
-
-#endif
-
-/* EOF */
Copied: branches/pingus_sdl/src/xml_pingus_level.cpp (from rev 2685,
branches/pingus_sdl/src/xml_pingus_level.cxx)
Deleted: branches/pingus_sdl/src/xml_pingus_level.cxx
===================================================================
--- branches/pingus_sdl/src/xml_pingus_level.cxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/xml_pingus_level.cxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,113 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <vector>
-#include <iostream>
-#include <ClanLib/Core/IOData/inputsource_provider_file.h>
-#include <ClanLib/Core/System/clanstring.h>
-#include <ClanLib/Core/XML/dom_node.h>
-#include <ClanLib/Core/XML/dom_attr.h>
-#include <ClanLib/Core/XML/dom_node_list.h>
-#include <ClanLib/Core/XML/dom_document.h>
-#include <ClanLib/Core/XML/dom_named_node_map.h>
-#include <ClanLib/Core/XML/dom_element.h>
-#include "pingus_error.hxx"
-////#include "xml_file_reader.hxx"
-#include "pingus_level_impl.hxx"
-#include "xml_pingus_level.hxx"
-
-
-XMLPingusLevel::XMLPingusLevel(const std::string& res_name,
- const std::string& filename)
-{
- impl->resname = res_name;
-
- CL_InputSourceProvider_File provider(".");
- CL_DomDocument doc(provider.open_source(filename), true);
-
- CL_DomElement root = doc.get_document_element();
-
- if (root.get_tag_name() != "pingus-level")
- {
- PingusError::raise("Error: " + filename + ": not a <pingus-level> file");
- }
- else
- {
- CL_DomNodeList lst = root.get_child_nodes();
-
- for(int i = 0; i < lst.get_length(); ++i)
- {
- CL_DomElement node = lst.item(i).to_element();
-
- if (node.get_tag_name() == "version")
- {
- int version =
CL_String::to_int(node.get_first_child().get_node_value());
-
- if (version < 2)
- {
- PingusError::raise("Error: Level version is " +
node.get_node_value()
- + ", can only handle level files of
version 2 or larger, use pingusv0tov1.xsl to convert them");
- }
- }
- else if (node.get_tag_name() == "head")
- {
- XMLFileReader reader(node);
- reader.read_string("levelname", impl->levelname);
- reader.read_string("description", impl->description);
- reader.read_size ("levelsize", impl->size);
- reader.read_string("music", impl->music);
- reader.read_int ("time", impl->time);
- reader.read_int ("difficulty", impl->difficulty);
- reader.read_int ("number-of-pingus", impl->number_of_pingus);
- reader.read_int ("number-to-save", impl->number_to_save);
- reader.read_color ("ambient-light", impl->ambient_light);
- reader.read_string("author", impl->author);
-
- if (impl->levelname ==
std::string())
- impl->levelname
= impl->resname;
-
- FileReader actions_reader;
- reader.read_section("actions", actions_reader);
- const std::vector<std::string>& actions =
actions_reader.get_section_names();
- for(std::vector<std::string>::const_iterator i =
actions.begin();
- i != actions.end(); ++i)
- {
- int count = 0;
- actions_reader.read_int(i->c_str(), count);
- impl->actions[*i] = count;
- }
- }
- else if (node.get_tag_name() == "objects")
- {
- CL_DomNodeList objects = node.get_child_nodes();
- for(int i = 0; i < objects.get_length(); ++i)
- {
-
impl->objects.push_back(XMLFileReader(objects.item(i).to_element()));
- }
- }
- else
- {
- std::cout << "Warning: Unknown element: " << node.get_tag_name()
<< std::endl;
- }
- }
- }
- }
-
-
-/* EOF */
Copied: branches/pingus_sdl/src/xml_pingus_level.hpp (from rev 2685,
branches/pingus_sdl/src/xml_pingus_level.hxx)
Deleted: branches/pingus_sdl/src/xml_pingus_level.hxx
===================================================================
--- branches/pingus_sdl/src/xml_pingus_level.hxx 2007-01-18 02:52:22 UTC
(rev 2685)
+++ branches/pingus_sdl/src/xml_pingus_level.hxx 2007-01-18 03:08:17 UTC
(rev 2686)
@@ -1,38 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_XML_PINGUS_LEVEL_HXX
-#define HEADER_XML_PINGUS_LEVEL_HXX
-
-#include "pingus_level.hxx"
-
-
-/** */
-class XMLPingusLevel : public PingusLevel
-{
-private:
-public:
- XMLPingusLevel(const std::string& res_name,
- const std::string& filename);
-};
-
-
-#endif
-
-/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2686 - in branches/pingus_sdl/src: . actions colliders components display editor gui input input/axes input/buttons input/pointers input/scrollers movers particles sound tinygettext worldmap worldobjs,
grumbel at BerliOS <=