summaryrefslogtreecommitdiff
path: root/digital/io-hub/src/guybrush/main.c
diff options
context:
space:
mode:
authorNicolas Schodet2012-05-18 10:43:19 +0200
committerNicolas Schodet2012-05-18 10:43:19 +0200
commitafdad624ffcd83d8f17ead0cb6a1fa0c7c436704 (patch)
tree4e94735c7861202e16e0c74c10011b651d78bd35 /digital/io-hub/src/guybrush/main.c
parent9af8f3670d7564befe658b9e7ad4d13426f305e2 (diff)
digital/io-hub/src/guybrush: slow down coin quartet collection
Diffstat (limited to 'digital/io-hub/src/guybrush/main.c')
-rw-r--r--digital/io-hub/src/guybrush/main.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/digital/io-hub/src/guybrush/main.c b/digital/io-hub/src/guybrush/main.c
index 2ea97110..ac561ec6 100644
--- a/digital/io-hub/src/guybrush/main.c
+++ b/digital/io-hub/src/guybrush/main.c
@@ -212,7 +212,26 @@ main_coin_detected_ok (void)
int16_t limit = robot_pos.v.y < PG_LENGTH - PG_CAPTAIN_ROOM_LENGTH_MM
? PG_HOLD_NORTH_X + BOT_SIZE_FRONT
: PG_CAPTAIN_ROOM_LENGTH_MM + BOT_SIZE_FRONT;
- return robot_pos.v.x > limit && robot_pos.v.x < PG_MIRROR_X (limit);
+ if (robot_pos.v.x < limit || robot_pos.v.x > PG_MIRROR_X (limit))
+ return 0;
+ if (robot_pos.v.y > PG_COIN_QUARTET_Y - 100
+ && robot_pos.v.y < PG_COIN_QUARTET_Y + 100)
+ {
+ if (robot_pos.a < POSITION_A_DEG (90)
+ || robot_pos.a > POSITION_A_DEG (270))
+ {
+ if (robot_pos.v.x > PG_COIN_QUARTET_X - BOT_SIZE_FRONT - 170
+ && robot_pos.v.x < PG_COIN_QUARTET_X - BOT_SIZE_FRONT + 170)
+ return 0;
+ }
+ else
+ {
+ if (robot_pos.v.x > PG_COIN_QUARTET_X + BOT_SIZE_FRONT - 170
+ && robot_pos.v.x < PG_COIN_QUARTET_X + BOT_SIZE_FRONT + 170)
+ return 0;
+ }
+ }
+ return 1;
}
/** Main events management. */