[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Enigma-devel] Bugs with item pickup
From: |
Jeremy Sawicki |
Subject: |
[Enigma-devel] Bugs with item pickup |
Date: |
Sun, 05 Jan 2003 16:13:50 -0500 |
A couple of small bugs (and fixes):
Sometimes enigma incorrectly thinks that a mouse button is down, and as a
result items cannot be picked up. This happens when the button is released
at an inconvenient time, such as when the game menu is displayed or in
between levels. Here is a fix for those two situations:
========
--- enigma.cc 5 Jan 2003 19:56:39 -0000 1.1
+++ enigma.cc 5 Jan 2003 21:11:30 -0000
@@ -246,6 +246,7 @@
void handle_events();
void on_keydown(SDL_Event &e);
void on_mousebutton(SDL_Event &e);
+ void update_mouse_button_state();
void change_state(State newstate);
void tick(double dtime);
void show_menu();
@@ -385,6 +386,7 @@
ShowScreen(video::TM_PUSH_RANDOM, video::BackBuffer());
// FX_Fade(video::FADEIN);
flush_events();
+ update_mouse_button_state();
last_tick_time = SDL_GetTicks();
return true;
}
@@ -473,22 +475,22 @@
if (e.button.button == 1) {
// left mousebutton -> activate first item in inventory
player::ActivateItem();
- player::InhibitPickup(true);
}
else if (e.button.button == 3) {
// right mousebutton -> rotate inventory
display::GetStatusBar()->hide_text();
player::RotateInventory();
- player::InhibitPickup(true);
- }
- }
- else {
- // mouse button released -> allow picking up items
- int b = SDL_GetMouseState(0, 0);
- if (!(b & SDL_BUTTON(1)) && !(b & SDL_BUTTON(3))) {
- player::InhibitPickup(false);
}
}
+
+ update_mouse_button_state();
+}
+
+void
+Game::update_mouse_button_state()
+{
+ int b = SDL_GetMouseState(0, 0);
+ player::InhibitPickup((b & SDL_BUTTON(1)) || (b & SDL_BUTTON(3)));
}
static void set_mousespeed(double spd)
@@ -608,6 +610,7 @@
GameMenu m;
m.manage(scr);
video::HideMouse();
+ update_mouse_button_state();
last_tick_time = SDL_GetTicks();
if (state != ABORT)
display::RedrawAll(get_screen());
========
Also, items should not be picked up when flying:
========
--- player.cc 5 Jan 2003 19:56:39 -0000 1.1
+++ player.cc 5 Jan 2003 21:14:29 -0000
@@ -322,6 +322,12 @@
return;
}
+ if (a->is_flying())
+ {
+ // do not pick up items while flying
+ return;
+ }
+
Inventory &inv = players[iplayer].inventory;
if (!inv.is_full())
{
========
Jeremy
- [Enigma-devel] Bugs with item pickup,
Jeremy Sawicki <=