summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-01-28 15:52:30 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-01-28 15:52:30 -0500
commit8f46c097bf0b3cf314af62a66428e04043d0a61f (patch)
tree8e2ebbb3698e2a36fdb261a3bb651a4cd34a1b6e /src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java
parentc29a8870d46edd635963d54b3ada87db10352b76 (diff)
downloadfourpuzzle-8f46c097bf0b3cf314af62a66428e04043d0a61f.tar.gz
fourpuzzle-8f46c097bf0b3cf314af62a66428e04043d0a61f.tar.bz2
fourpuzzle-8f46c097bf0b3cf314af62a66428e04043d0a61f.zip
Created a manager for SpecialEvent action threads
EventHandler controls when they are executed and allows MapViewGameState to poll it to see if it is currently managing any action threads. If it is, MapViewGameState should be able to prevent certain actions from occuring (unless the action thread is ParallelProcess) such as keyboard input.
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java')
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java index 0604dd0..65d2d2d 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java
@@ -13,6 +13,7 @@ import com.fourisland.fourpuzzle.Game;
13import com.fourisland.fourpuzzle.Layer; 13import com.fourisland.fourpuzzle.Layer;
14import com.fourisland.fourpuzzle.PuzzleApplication; 14import com.fourisland.fourpuzzle.PuzzleApplication;
15import com.fourisland.fourpuzzle.gamestate.mapview.event.EventCallTime; 15import com.fourisland.fourpuzzle.gamestate.mapview.event.EventCallTime;
16import com.fourisland.fourpuzzle.gamestate.mapview.event.EventHandler;
16import com.fourisland.fourpuzzle.gamestate.mapview.event.EventList; 17import com.fourisland.fourpuzzle.gamestate.mapview.event.EventList;
17import com.fourisland.fourpuzzle.gamestate.mapview.event.LayerEvent; 18import com.fourisland.fourpuzzle.gamestate.mapview.event.LayerEvent;
18import com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove.MoveEventThread; 19import com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove.MoveEventThread;
@@ -72,7 +73,7 @@ public class MapViewGameState implements GameState {
72 debugWalkthrough = false; 73 debugWalkthrough = false;
73 } 74 }
74 75
75 if (!hero.isMoving() && !MoveEventThread.isHeroMoving()) 76 if (!hero.isMoving() && !MoveEventThread.isHeroMoving() && !EventHandler.isRunningEvent())
76 { 77 {
77 Direction toMove = null; 78 Direction toMove = null;
78 Boolean letsMove = false; 79 Boolean letsMove = false;
@@ -113,12 +114,12 @@ public class MapViewGameState implements GameState {
113 if (Functions.isFacing(hero, ev)) 114 if (Functions.isFacing(hero, ev))
114 { 115 {
115 ev.setDirection(Functions.oppositeDirection(hero.getDirection())); 116 ev.setDirection(Functions.oppositeDirection(hero.getDirection()));
116 ev.getCallback().activate(); 117 ev.getCallback().activate(ev.getCalltime());
117 } 118 }
118 } else { 119 } else {
119 if (ev.getLocation().equals(hero.getLocation())) 120 if (ev.getLocation().equals(hero.getLocation()))
120 { 121 {
121 ev.getCallback().activate(); 122 ev.getCallback().activate(ev.getCalltime());
122 } 123 }
123 } 124 }
124 } 125 }
@@ -144,11 +145,19 @@ public class MapViewGameState implements GameState {
144 { 145 {
145 if (!MoveEventThread.isOtherMoving(ev)) 146 if (!MoveEventThread.isOtherMoving(ev))
146 { 147 {
147 ev.startMoving(currentMap); 148 if (!EventHandler.isRunningEvent())
149 {
150 ev.startMoving(currentMap);
151 }
148 } 152 }
149 } else { 153 } else {
150 ev.processMoving(); 154 ev.processMoving();
151 } 155 }
156
157 if (ev.getCalltime() == EventCallTime.ParallelProcess)
158 {
159 ev.getCallback().activate(ev.getCalltime());
160 }
152 } 161 }
153 } 162 }
154 163