Skip to content

Commit 9a3028e

Browse files
authored
Merge pull request #62 from jsmolina/fix-switch-level
fix: switch level does not keep frightened mnode
2 parents 93aeaa7 + 783b748 commit 9a3028e

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

logic.c

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -579,11 +579,29 @@ void move_ghosts() {
579579

580580
}
581581

582+
// finishes frightened state for ghosts
583+
inline void end_frightened() {
584+
sonido2Sirena();
585+
pill_eaten = NONE;
586+
for(idx = 0; idx != 4; ++idx) {
587+
if(ghosts[idx]->active == FRIGHTENED) {
588+
ghosts[idx]->active = CHASE;
589+
reset_colors(ghosts[idx]);
590+
}
591+
}
592+
sp1_IterateSprChar(ghost_red.sp, initialiseColourGhostRed);
593+
sp1_IterateSprChar(ghost_cyan.sp, initialiseColourGhostCyan);
594+
sp1_IterateSprChar(ghost_magenta.sp, initialiseColourGhostMagenta);
595+
sp1_IterateSprChar(ghost_yellow.sp, initialiseColourYellow);
596+
}
597+
582598

583599
void next_level() {
600+
stop_ay();
584601
resetSiren();
585602
sonido3InsertCoin();
586603
++level;
604+
end_frightened();
587605
// helps determining scatter mode changes and some others
588606
slowticker = 0;
589607
++reached_level;
@@ -745,18 +763,7 @@ void check_fsm() {
745763
}
746764

747765
if(pill_eaten == 0) {
748-
sonido2Sirena();
749-
pill_eaten = NONE;
750-
for(idx = 0; idx != 4; ++idx) {
751-
if(ghosts[idx]->active == FRIGHTENED) {
752-
ghosts[idx]->active = CHASE;
753-
reset_colors(ghosts[idx]);
754-
}
755-
}
756-
sp1_IterateSprChar(ghost_red.sp, initialiseColourGhostRed);
757-
sp1_IterateSprChar(ghost_cyan.sp, initialiseColourGhostCyan);
758-
sp1_IterateSprChar(ghost_magenta.sp, initialiseColourGhostMagenta);
759-
sp1_IterateSprChar(ghost_yellow.sp, initialiseColourYellow);
766+
end_frightened();
760767
}
761768

762769
if(cherry.showing > 0) {

msnampac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void all_lives_lost() {
7979
ghost_yellow.default_color = initialiseColourYellow;
8080

8181
printatstr(4, 10, INK_YELLOW | BRIGHT | PAPER_BLACK, "MS.NAM-PAC");
82-
printatstr(5, 10, INK_YELLOW | PAPER_BLACK, " V0.1");
82+
printatstr(5, 10, INK_YELLOW | PAPER_BLACK, " V0.2");
8383

8484
printatstr(8, 10, INK_WHITE |BRIGHT | PAPER_BLACK, "1.KEYBOARD");
8585
printatstr(9, 10, INK_WHITE|BRIGHT | PAPER_BLACK, "2.KEMPSTON");

0 commit comments

Comments
 (0)