diff options
author | Moshe Piekarski <mendelmunkis@protonmail.com> | 2019-11-03 17:46:07 -0500 |
---|---|---|
committer | Franklin Wei <franklin@rockbox.org> | 2019-11-03 21:31:19 -0500 |
commit | 85a437780e2f259fffec2586176c363dd1585d41 (patch) | |
tree | 838868294f74c6bfce974be3621c8f6b835f96ad | |
parent | 86a313a1772bfb77390c997d49476418c42e5c74 (diff) | |
download | rockbox-85a437780e2f259fffec2586176c363dd1585d41.tar.gz rockbox-85a437780e2f259fffec2586176c363dd1585d41.zip |
Pacbox AI Improvements
-Make pacbox AI score agnostic.
-Fix corner case of Game Over/reset with AI on.
-AI can now start on level where pattern starts facing right.
Change-Id: Ibc5416a53ebc07506c31434051b6d47b276cf668
-rwxr-xr-x | apps/plugins/pacbox/pacbox.c | 111 |
1 files changed, 48 insertions, 63 deletions
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c index fd8fdcd4db..e635b3ca4d 100755 --- a/apps/plugins/pacbox/pacbox.c +++ b/apps/plugins/pacbox/pacbox.c | |||
@@ -73,7 +73,7 @@ static unsigned char ai_direction[15][205] = /* level turn directio | |||
73 | {2,0,3,1,3,1,2,0,2,0,2,0,3,1,3,1,2,1,2,0,3,0,3,0,3,1,3,1,2,1,2,0,2,0,3,0,2,0,3,1,2,0,3,1,2,0,2,1,2,1,2,0,2,0,3,1,0,3,0,3,2,0,2,0,2,0,3,1,0,3,2,0,2,1,2,1,3,0,3,1,3,1,3,0,3,0,1,2,1,3,1,3,1,2},/* second level*/ | 73 | {2,0,3,1,3,1,2,0,2,0,2,0,3,1,3,1,2,1,2,0,3,0,3,0,3,1,3,1,2,1,2,0,2,0,3,0,2,0,3,1,2,0,3,1,2,0,2,1,2,1,2,0,2,0,3,1,0,3,0,3,2,0,2,0,2,0,3,1,0,3,2,0,2,1,2,1,3,0,3,1,3,1,3,0,3,0,1,2,1,3,1,3,1,2},/* second level*/ |
74 | {2,1,3,1,2,0,2,0,3,0,2,1,3,1,2,1,2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0,2,0,2,0,3,1,2,1,3,1,2,1,3,1,2,1,2,1,3,1,3,0,2,0,3,1,2,1,2,0,2,0,3,0,2,0,3,1,3,0,2,1,2,1,2,0,3,0,2,0,3,1,2,0,2,1,2,1,2,1,2,0,2,0,3,0,2,1,3,0,3,0,1,2,1,3,1,2,1,0,3,0,2,0,2,1,2,0,2,0,3,1,3,0,2,1,2,1,2,0,3,0,2,0,3,1,2,0,2,1,2,1,2,1,2,0,2,0,3,0,2,1,3,0,3,0,1,2,1,3,1,2,1,0,3,0,2,0,2,1,2,0,2,0,3,1,3,0,2,1,2,1,2,},/*level ten*/ |
@@ -87,17 +87,17 @@ static unsigned char ai_direction[15][205] = /* level turn directio | |||
87 | }; | 87 | }; |
88 | static unsigned char ai_location[15][205] = /* level turn locations */ | 88 | static unsigned char ai_location[15][205] = /* level turn locations */ |
89 | { | 89 | { |
90 | {0,52,58,57,61,34,60,37,54,43,55,42,58,43,61,46,60,49,57,48,54,49,51,42,52,43,55,39,54,34,55,34,58,37,107,52,58,57,61,48,60,49,57,52,42,57,39,48,35,57,40,54,39,48,35,52,37,51,40,48,43,45,42,42,39,39,35,43,37,49,40,48,43,42,49,49,45,45,42,42,39,39,40,34,39,43,35,34,40,37,39,223,39,55,52,54,57,55,57,58,54,57,119,52,58,55,57,57,54,53}, /* first level */ | 90 | {0,52,58,57,61,34,60,37,54,43,55,42,58,43,61,46,60,49,57,48,54,49,51,42,52,43,55,39,54,34,55,34,58,37,26,52,58,57,61,48,60,49,57,52,42,57,39,48,35,57,40,54,39,48,35,52,37,51,40,48,43,45,42,42,39,39,35,43,37,49,40,48,43,42,49,49,45,45,42,42,39,39,40,34,39,43,35,34,40,37,39,3,39,55,52,54,57,55,57,58,54,57,3,52,58,55,57,57,54,53}, /* first level */ |
91 | {0,47,54,52,58,57,61,45,60,42,57,39,54,43,55,49,58,48,61,34,60,37,54,40,51,49,52,57,55,57,58,54,54,51,48,52,39,48,35,57,40,54,39,57,40,54,35,48,37,40,56,37,57,33,54,37,125,54,40,51,170,42,48,39,39,34,35,37,174,39,220,45,35,39,37,34,40,37,39,40,40,43,43,46,42,49,16,40,48,42,48,45,52,55}, /*second level */ | 91 | {0,47,54,52,58,57,61,45,60,42,57,39,54,43,55,49,58,48,61,34,60,37,54,40,51,49,52,57,55,57,58,54,54,51,48,52,39,48,35,57,40,54,39,57,40,54,35,48,37,40,56,37,57,33,54,37,2,54,40,51,4,42,48,39,39,34,35,37,1,39,4,45,35,39,37,34,40,37,39,40,40,43,43,46,42,49,16,40,48,42,48,45,52,55}, /*second level */ |
92 | {0,52,58,57,61,45,60,42,57,43,54,39,55,49,58,48,61,34,60,37,54,40,51,49,52,57,55,57,58,54,54,51,51,139,49,48,52,42,57,39,48,35,57,40,54,39,48,35,52,37,51,40,48,43,49,46,52,55,39,54,34,55,34,58,37,57,43,54,42,51,49,52,48,55,39,35,43,37,49,40,48,43,45,42,42,39,39,35,43,37,39,35,34,37,43,127,37,39,40,34}, /*third level */ | 92 | {0,52,58,57,61,45,60,42,57,43,54,39,55,49,58,48,61,34,60,37,54,40,51,49,52,57,55,57,58,54,54,51,51,4,49,48,52,42,57,39,48,35,57,40,54,39,48,35,52,37,51,40,48,43,49,46,52,55,39,54,34,55,34,58,37,57,43,54,42,51,49,52,48,55,39,35,43,37,49,40,48,43,45,42,42,39,39,35,43,37,39,35,34,37,43,3,37,39,40,34}, /*third level */ |
93 | {0,52,58,57,61,45,60,42,57,43,54,39,55,49,58,48,61,34,60,37,54,40,51,49,52,57,55,57,58,54,54,51,51,71,49,48,52,42,57,39,48,35,57,40,54,39,48,35,52,37,51,40,48,43,49,46,52,55,45,54,39,48,40,49,49,52,48,55,45,54,42,45,43,42,42,39,43,35,39,37,34,40,37,39,43,35,34,151,35,37,37,49,40,48,43,42,52,43,55,46,54,49,51,42,48,39,52,34,55,34,58,37,54,43,55,87,45,54,42,48,39,88}, /*fourth level */ | 93 | {0,52,58,57,61,45,60,42,57,43,54,39,55,49,58,48,61,34,60,37,54,40,51,49,52,57,55,57,58,54,54,51,51,4,49,48,52,42,57,39,48,35,57,40,54,39,48,35,52,37,51,40,48,43,49,46,52,55,45,54,39,48,40,49,49,52,48,55,45,54,42,45,43,42,42,39,43,35,39,37,34,40,37,39,43,35,34,1,35,37,37,49,40,48,43,42,52,43,55,46,54,49,51,42,48,39,52,34,55,34,58,37,54,43,55,4,45,54,42,48,39,1}, /*fourth level */ |
94 | {0,14,39,58,34,61,46,60,49,57,45,54,42,45,43,42,42,39,39,35,43,37,42,40,43,43,42,49,49,52,48,55,42,58,43,61,57,60,54,54,57,55,57,58,54,57,48,54,52,39,48,35,52,37,57,35,54,46,51,49,42,48,39,42,34,39,37,35,43,37,49,40,48,43,49,46,52,42,57,39,39,35,34,37,40,105,43,35,39,40,34,39,40,40,43,43,49,52,48,55,45,54,39,58,36,57,34,54,37,55,43,54,39,51}, /*fifth level */ | 94 | {0,14,39,58,34,61,46,60,49,57,45,54,42,45,43,42,42,39,39,35,43,37,42,40,43,43,42,49,49,52,48,55,42,58,43,61,57,60,54,54,57,55,57,58,54,57,48,54,52,39,48,35,52,37,57,35,54,46,51,49,42,48,39,42,34,39,37,35,43,37,49,40,48,43,49,46,52,42,57,39,39,35,34,37,40,3,43,35,39,40,34,39,40,40,43,43,49,52,48,55,45,54,39,58,36,57,34,54,37,55,43,54,39,51}, /*fifth level */ |
95 | {0,184,39,58,34,61,46,60,49,57,45,54,42,45,43,42,42,39,39,35,43,37,42,40,43,43,42,49,49,52,48,55,42,58,43,61,57,60,54,54,57,55,57,58,54,57,48,54,52,39,48,35,52,37,57,35,54,46,51,49,42,45,43,42,42,39,52,40,57,39,51,40,48,43,45,42,42,39,43,35,39,40,34,39,37,35,34,37,37,35,34,200,37,46,40,45,49,49,42,52,39,58,36,57,34,54,37,55,52,119,54,48,37,},/*sixth level*/ | 95 | {0,14,39,58,34,61,46,60,49,57,45,54,42,45,43,42,42,39,39,35,43,37,42,40,43,43,42,49,49,52,48,55,42,58,43,61,57,60,54,54,57,55,57,58,54,57,48,54,52,39,48,35,52,37,57,35,54,46,51,49,42,45,43,42,42,39,52,40,57,39,51,40,48,43,45,42,42,39,43,35,39,40,34,39,37,35,34,37,37,35,34,3,37,46,40,45,49,49,42,52,39,58,36,57,34,54,37,55,52,4,54,48,37,},/*sixth level*/ |
96 | {0,52,58,57,61,45,60,42,57,43,54,42,51,49,48,52,55,45,54,42,48,39,52,40,45,49,52,52,48,51,49,42,45,49,52,52,55,42,58,43,61,57,60,54,54,57,55,57,58,57,61,48,60,49,57,48,54,52,55,48,54,52,55,51,58,48,61,45,60,42,57,39,48,40,45,49,46,40,49,49,48,52,52,48,55,52,58,57,61,48,60,49,57,42,58,43,61,34,60,37,54,34,55,34,58,118,34,61,43,60,42,57,39,48,54,52,57,55,57,58,57,61,48,60,49,57,39,48,40,52,43,55,39,42,34,39,37,40,34,39,37,35,34,37,37,35,43,37,42,40,43,43,42,46,51,49,42,48,39,55,52,48,51,49,42,52,39,48,54,52,51,51,42,52,39,48,54,42,57,39,54,35,57,37,141,35,48,37,49,40,48,43,49,46,52,39},/*ninth level*/ | 96 | {0,52,58,57,61,45,60,42,57,43,54,42,51,49,48,52,55,45,54,42,48,39,52,40,45,49,52,52,48,51,49,42,45,49,52,52,55,42,58,43,61,57,60,54,54,57,55,57,58,57,61,48,60,49,57,48,54,52,55,48,54,52,55,51,58,48,61,45,60,42,57,39,48,40,45,49,46,40,49,49,48,52,52,48,55,52,58,57,61,48,60,49,57,42,58,43,61,34,60,37,54,34,55,34,58,1,34,61,43,60,42,57,39,48,54,52,57,55,57,58,57,61,48,60,49,57,39,48,40,52,43,55,39,42,34,39,37,40,34,39,37,35,34,37,37,35,43,37,42,40,43,43,42,46,51,49,42,48,39,55,52,48,51,49,42,52,39,48,54,52,51,51,42,52,39,48,54,42,57,39,54,35,57,37,4,35,48,37,49,40,48,43,49,46,52,39},/*ninth level*/ |
97 | {0,14,39,58,34,61,46,60,49,57,45,54,42,45,43,42,42,39,39,35,43,37,42,40,43,43,42,49,49,52,48,55,42,58,43,61,57,60,54,54,57,55,57,58,54,57,48,54,52,39,48,35,52,37,57,35,54,46,51,49,42,45,43,42,42,39,57,40,54,39,51,40,48,43,42,46,39,42,34,39,37,35,34,40,37,39,43,205,37,42,40,43,43,42,73,45,43,42,42,39,39,58,36,57,34,54,37,55,52,48,51,49,42,52,45,60,},/*tenth level*/ | 97 | {0,14,39,58,34,61,46,60,49,57,45,54,42,45,43,42,42,39,39,35,43,37,42,40,43,43,42,49,49,52,48,55,42,58,43,61,57,60,54,54,57,55,57,58,54,57,48,54,52,39,48,35,52,37,57,35,54,46,51,49,42,45,43,42,42,39,57,40,54,39,51,40,48,43,42,46,39,42,34,39,37,35,34,40,37,39,43,3,37,42,40,43,43,42,4,45,43,42,42,39,39,58,36,57,34,54,37,55,52,48,51,49,42,52,45,60,},/*tenth level*/ |
98 | {0,52,58,57,61,45,60,42,57,43,54,42,51,49,48,52,55,45,54,42,48,39,52,40,45,49,52,52,48,51,49,42,45,49,52,52,55,42,58,43,61,57,60,54,54,57,55,57,58,57,61,48,60,49,57,48,54,52,55,48,54,52,55,51,58,48,61,45,60,42,57,39,48,40,45,49,46,40,49,49,48,52,52,48,55,52,58,57,61,48,60,49,57,42,58,43,61,34,60,37,54,34,55,34,58,94,34,61,43,60,42,57,39,48,54,52,57,55,57,58,57,61,48,60,49,57,39,48,40,52,43,55,39,42,34,39,37,40,34,39,37,35,34,37,37,191,46,40,45,49,46,52,39,42,40,43,43,49,49,42,52,39,55,52,48,51,49,42,52,39,48,54,39,48,35,57,37,51,40,48,43,45,42,42,39,39,35,43,37,57,40,54,35},/*twelfth level*/ | 98 | {0,52,58,57,61,45,60,42,57,43,54,42,51,49,48,52,55,45,54,42,48,39,52,40,45,49,52,52,48,51,49,42,45,49,52,52,55,42,58,43,61,57,60,54,54,57,55,57,58,57,61,48,60,49,57,48,54,52,55,48,54,52,55,51,58,48,61,45,60,42,57,39,48,40,45,49,46,40,49,49,48,52,52,48,55,52,58,57,61,48,60,49,57,42,58,43,61,34,60,37,54,34,55,34,58,1,34,61,43,60,42,57,39,48,54,52,57,55,57,58,57,61,48,60,49,57,39,48,40,52,43,55,39,42,34,39,37,40,34,39,37,35,34,37,37,4,46,40,45,49,46,52,39,42,40,43,43,49,49,42,52,39,55,52,48,51,49,42,52,39,48,54,39,48,35,57,37,51,40,48,43,45,42,42,39,39,35,43,37,57,40,54,35},/*twelfth level*/ |
99 | {0,14,39,58,34,61,46,60,49,57,45,54,42,45,43,42,42,39,39,35,43,37,42,40,43,43,42,49,49,52,48,55,42,58,43,61,57,60,54,54,57,55,57,58,54,57,48,54,52,39,48,35,52,37,48,35,57,37,54,35,104,52,37,51,40,48,43,49,49,42,48,39,42,34,39,57,40,54,46,51,49,42,48,39,52,34,55,34,58,37,54,40,51,49,48,52,39,42,40,43,43,49,52,52,48,37,42,34,39,37,35,34,37,37,35,43,37,127,39},/*fourteenth level*/ | 99 | {0,14,39,58,34,61,46,60,49,57,45,54,42,45,43,42,42,39,39,35,43,37,42,40,43,43,42,49,49,52,48,55,42,58,43,61,57,60,54,54,57,55,57,58,54,57,48,54,52,39,48,35,52,37,48,35,57,37,54,35,4,52,37,51,40,48,43,49,49,42,48,39,42,34,39,57,40,54,46,51,49,42,48,39,52,34,55,34,58,37,54,40,51,49,48,52,39,42,40,43,43,49,52,52,48,37,42,34,39,37,35,34,37,37,35,43,37,4,39},/*fourteenth level*/ |
100 | {0,52,58,57,61,45,60,42,57,43,54,42,51,49,48,52,55,45,54,42,48,39,52,40,45,45,52,52,48,51,49,42,45,49,52,52,55,42,58,43,61,57,60,54,54,57,55,57,58,57,61,48,60,49,57,48,54,52,55,48,54,52,55,51,58,48,61,45,60,42,57,39,48,40,45,49,46,40,49,49,48,52,52,48,55,52,58,57,61,48,60,49,57,42,58,43,61,34,60,37,54,34,55,34,58,124,34,61,43,60,42,57,39,48,54,52,57,55,57,58,57,61,48,60,49,57,39,48,40,52,43,55,39,54,40,45,49,49,42,52,43,55,52,54,51,48,37,41,34,39,37,35,34,37,37,46,40,45,46,42,49,39,42,40,43,43,42,49,49,48,52,55,39,54,40,48,54,39,48,35,57,159,173,37,54,40,57,39,54,35,48,37,45,35,39,37,40}, | 100 | {0,52,58,57,61,45,60,42,57,43,54,42,51,49,48,52,55,45,54,42,48,39,52,40,45,45,52,52,48,51,49,42,45,49,52,52,55,42,58,43,61,57,60,54,54,57,55,57,58,57,61,48,60,49,57,48,54,52,55,48,54,52,55,51,58,48,61,45,60,42,57,39,48,40,45,49,46,40,49,49,48,52,52,48,55,52,58,57,61,48,60,49,57,42,58,43,61,34,60,37,54,34,55,34,58,1,34,61,43,60,42,57,39,48,54,52,57,55,57,58,57,61,48,60,49,57,39,48,40,52,43,55,39,54,40,45,49,49,42,52,43,55,52,54,51,48,37,41,34,39,37,35,34,37,37,46,40,45,46,42,49,39,42,40,43,43,42,49,49,48,52,55,39,54,40,48,54,39,48,35,57,2,3,37,54,40,57,39,54,35,48,37,45,35,39,37,40}, |
101 | {0,14,39,58,34,61,46,60,49,57,48,54,52,48,51,45,48,42,49,39,42,40,43,43,42,49,49,52,52,58,57,61,45,60,42,57,39,39,52,55,45,54,39,42,34,39,37,35,43,37,46,35,52,46,51,49,42,48,54,42,57,35,54,37,57,40,54,39,45,35,34,40,37,52,34,55,34,58,34,61,57,60,57,57,57,53}, | 101 | {0,14,39,58,34,61,46,60,49,57,48,54,52,48,51,45,48,42,49,39,42,40,43,43,42,49,49,52,52,58,57,61,45,60,42,57,39,39,52,55,45,54,39,42,34,39,37,35,43,37,46,35,52,46,51,49,42,48,54,42,57,35,54,37,57,40,54,39,45,35,34,40,37,52,34,55,34,58,34,61,57,60,57,57,57,53}, |
102 | {0,14,39,58,34,61,46,60,49,57,48,54,52,48,51,45,48,42,49,39,42,40,43,43,42,49,49,52,52,58,57,61,45,60,42,57,39,39,52,55,45,54,39,42,34,39,37,35,43,37,49,40,48,43,49,49,42,52,34,55,34,58,37,42,34,35,43,37,57,35,54,37,57,40,54,35,48,37,49,40,48,43,49,46,52,52,57,55,57}, | 102 | {0,14,39,58,34,61,46,60,49,57,48,54,52,48,51,45,48,42,49,39,42,40,43,43,42,49,49,52,52,58,57,61,45,60,42,57,39,39,52,55,45,54,39,42,34,39,37,35,43,37,49,40,48,43,49,49,42,52,34,55,34,58,37,42,34,35,43,37,57,35,54,37,57,40,54,35,48,37,49,40,48,43,49,46,52,52,57,55,57}, |
103 | {0,52,58,57,61,34,60,37,54,43,55,42,58,43,61,46,60,49,57,52,54,48,55,52,58,55,57,57,54,54,48,51,49,42,52,43,55,39,58,36,57,34,54,37,42,34,39,37,35,43,37,39,35,34,37,37,46,40,49,49,48,52,35,48,37,49,40,48,43,45,42,42,39,52,35,57,37,54,40,57}, | 103 | {0,52,58,57,61,34,60,37,54,43,55,42,58,43,61,46,60,49,57,52,54,48,55,52,58,55,57,57,54,54,48,51,49,42,52,43,55,39,58,36,57,34,54,37,42,34,39,37,35,43,37,39,35,34,37,37,46,40,49,49,48,52,35,48,37,49,40,48,43,45,42,42,39,52,35,57,37,54,40,57}, |
@@ -511,74 +511,43 @@ unsigned char ai( unsigned char turn ) | |||
511 | 511 | ||
512 | /*Select level map*/ | 512 | /*Select level map*/ |
513 | if(ram_[0x4E13] < 20) | 513 | if(ram_[0x4E13] < 20) |
514 | { | ||
515 | level=map[ram_[0x4E13]]; | 514 | level=map[ram_[0x4E13]]; |
516 | }else if(ram_[0x4E13] != 255) | 515 | else if(ram_[0x4E13] != 255) |
517 | level=13; | 516 | level=13; |
518 | else | 517 | else |
519 | level=14; | 518 | level=14; |
520 | 519 | ||
521 | if((level == 4) || (level == 8) || (level == 10)) | ||
522 | { | ||
523 | switch(ram_[0x4E13]) | ||
524 | { | ||
525 | case 4: | ||
526 | ai_location[4][85] = 105; | ||
527 | break; | ||
528 | case 6: | ||
529 | ai_location[4][85] = 143; | ||
530 | break; | ||
531 | case 7: | ||
532 | ai_location[4][85] = 91; | ||
533 | break; | ||
534 | case 10: | ||
535 | ai_location[4][85] = 217; | ||
536 | break; | ||
537 | case 11: | ||
538 | ai_location[8][105] = 94; | ||
539 | ai_location[8][145] = 191; | ||
540 | break; | ||
541 | case 12: | ||
542 | ai_location[8][105] = 138; | ||
543 | ai_location[8][145] = 75; | ||
544 | break; | ||
545 | case 14: | ||
546 | ai_location[10][105] = 124; | ||
547 | ai_location[10][181] = 159; | ||
548 | ai_location[10][182] = 173; | ||
549 | break; | ||
550 | case 15: | ||
551 | ai_location[10][105] = 200; | ||
552 | ai_location[10][181] = 75; | ||
553 | ai_location[10][182] = 89; | ||
554 | break; | ||
555 | case 17: | ||
556 | ai_location[10][105] = 154; | ||
557 | ai_location[10][181] = 189; | ||
558 | ai_location[10][182] = 203; | ||
559 | default: | ||
560 | break; | ||
561 | } | ||
562 | } | ||
563 | |||
564 | /* AI can't start in middle of a level */ | 520 | /* AI can't start in middle of a level */ |
565 | if( turn > 200) | 521 | if( turn > 210) |
566 | { | 522 | { |
567 | rb->splash(HZ/2, "AI will engage at next level start"); | 523 | rb->splash(HZ/2, "AI will engage at next level start"); |
568 | return 0; | 524 | return 0; |
569 | } | 525 | } |
526 | |||
527 | /* reset joystick direction on level start */ | ||
528 | if(!(ram_[0x4E0E] || turn)) | ||
529 | { | ||
530 | /*levels that start facing right */ | ||
531 | if((level != 4) && (level != 11) && (level != 7) && (level != 5) && (level != 9) && (level !=12)) | ||
532 | clear_joystick(); | ||
533 | else | ||
534 | { | ||
535 | clear_joystick(); | ||
536 | setDeviceMode( Joy1_Right, DeviceOn); | ||
537 | } | ||
538 | return 1; | ||
539 | } | ||
570 | if( turn == 0) | 540 | if( turn == 0) |
571 | { | 541 | { |
572 | if( (ram_[0x4E0E] == 1) && (ram_[0x4D3A] == 47)) | 542 | if( (ram_[0x4E0E] == 1) && (ram_[0x4D3A] == 47)) |
573 | { | 543 | { |
574 | turn++; | 544 | turn=1; |
575 | } | 545 | } |
576 | joystick(); | 546 | joystick(); |
577 | return turn; | 547 | return turn; |
578 | } | 548 | } |
579 | 549 | ||
580 | 550 | if((turn != 0) && (turn !=209)) | |
581 | if(turn != 0) | ||
582 | { | 551 | { |
583 | /* set which axis to look for pac-man along */ | 552 | /* set which axis to look for pac-man along */ |
584 | position = ram_[0x4D3A]; | 553 | position = ram_[0x4D3A]; |
@@ -593,6 +562,15 @@ unsigned char ai( unsigned char turn ) | |||
593 | { | 562 | { |
594 | if(ai_location[level][turn] < 30) /* handle turns using pinky's location as basis for turn timing */ | 563 | if(ai_location[level][turn] < 30) /* handle turns using pinky's location as basis for turn timing */ |
595 | { | 564 | { |
565 | if((ai_location[level][turn] < 10) && (ai_location[level][turn] > 0)) | ||
566 | { | ||
567 | if( ram_[0x4DD0] == ai_location[level][turn]) | ||
568 | { | ||
569 | ai_turn(level,turn); | ||
570 | turn++; | ||
571 | } | ||
572 | } | ||
573 | |||
596 | if( ram_[0x4D31] == (ai_location[level][turn] + 30)) | 574 | if( ram_[0x4D31] == (ai_location[level][turn] + 30)) |
597 | { | 575 | { |
598 | ai_turn(level,turn); | 576 | ai_turn(level,turn); |
@@ -619,6 +597,11 @@ unsigned char ai( unsigned char turn ) | |||
619 | /*levels that start facing right */ | 597 | /*levels that start facing right */ |
620 | if((level != 4) && (level != 11) && (level != 7) && (level != 5) && (level != 9) && (level !=12)) | 598 | if((level != 4) && (level != 11) && (level != 7) && (level != 5) && (level != 9) && (level !=12)) |
621 | clear_joystick(); | 599 | clear_joystick(); |
600 | else | ||
601 | { | ||
602 | clear_joystick(); | ||
603 | setDeviceMode( Joy1_Right, DeviceOn); | ||
604 | } | ||
622 | return 1; | 605 | return 1; |
623 | } | 606 | } |
624 | return turn; | 607 | return turn; |
@@ -699,8 +682,10 @@ static int gameProc( void ) | |||
699 | turn = 250; | 682 | turn = 250; |
700 | } | 683 | } |
701 | /* run ai */ | 684 | /* run ai */ |
702 | if (settings.ai) | 685 | if (settings.ai && !ram_[0x4E02]) |
703 | turn = ai(turn); | 686 | turn = ai(turn); |
687 | else | ||
688 | joystick(); | ||
704 | #else | 689 | #else |
705 | joystick(); | 690 | joystick(); |
706 | #endif | 691 | #endif |
@@ -833,4 +818,4 @@ enum plugin_status plugin_start(const void* parameter) | |||
833 | backlight_use_settings(); | 818 | backlight_use_settings(); |
834 | 819 | ||
835 | return PLUGIN_OK; | 820 | return PLUGIN_OK; |
836 | }// | 821 | } |