summaryrefslogtreecommitdiffhomepage
path: root/digital
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
parent9af8f3670d7564befe658b9e7ad4d13426f305e2 (diff)
digital/io-hub/src/guybrush: slow down coin quartet collection
Diffstat (limited to 'digital')
-rw-r--r--digital/io-hub/src/guybrush/main.c21
-rw-r--r--digital/io-hub/src/guybrush/playground_2012.h4
2 files changed, 24 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. */
diff --git a/digital/io-hub/src/guybrush/playground_2012.h b/digital/io-hub/src/guybrush/playground_2012.h
index d33ed472..571ffc09 100644
--- a/digital/io-hub/src/guybrush/playground_2012.h
+++ b/digital/io-hub/src/guybrush/playground_2012.h
@@ -62,4 +62,8 @@
#define PG_BOTTLE2_X PG_MIRROR_X (PG_BOTTLE1_X)
#define PG_BOTTLE3_X PG_MIRROR_X (PG_BOTTLE0_X)
+/** 4 coins. */
+#define PG_COIN_QUARTET_X (PG_WIDTH / 2)
+#define PG_COIN_QUARTET_Y 300
+
#endif /* playground_2012_h */