1. In the original game, holding_sword is used only to determine which music to play when the prince dies.
In the Apple II source, this variable is called "heroic"; and the "death in fight" music is called "heroic death".
It might make sense that it's not set to 0 if the prince falls from fighting.
For example, if a guard pushes the prince into a pit and he dies there, it makes sense to play the "death in fight" music.
2. Strangely, holding_sword is set to 0 if I back off the screen to the right from the guard in room 8 of level 5 (to room 7).
That happens in control_with_sword(). At that point, can_guard_see_kid is 1 for some reason.
To find out why is can_guard_see_kid set to 1, I added these debug printouts in check_can_guard_see_kid():
Code: Select all
printf("left_pos = %d, right_pos = %d\n", left_pos, right_pos);
if (right_pos >= left_pos) {
[...]
printf("can_guard_see_kid set to 1, because curr_tile2 = %d\n", curr_tile2);
printf("Kid.room = %d, Guard.room = %d, drawn_room = %d\n", Kid.room, Guard.room, drawn_room);
printf("Kid.curr_col = %d, Guard.curr_col = %d\n", Kid.curr_col, Guard.curr_col);
can_guard_see_kid = 1;
Code: Select all
left_pos = 163, right_pos = 205
can_guard_see_kid set to 1, because curr_tile2 = 4
Kid.room = 7, Guard.room = 7, drawn_room = 7
Kid.curr_col = 10, Guard.curr_col = 7
So the game is looking at the top right part of room 7, sees the closed gate, and thinks it's between the prince and the guard.
But this won't cause the prince actually sheathe his sword. I wonder why.