$$ACTION Scripts Handle Change Room for Priest Key Puzzle aPriestKeyRoomChange Call this whenever a player changes rooms $$END */
| 1136 | $$END |
| 1137 | */ |
| 1138 | void aPriestKeyRoomChange(void) { |
| 1139 | if (!PriestKeyInit) |
| 1140 | PriestInit(); // handle the case of load/save hosing us |
| 1141 | |
| 1142 | // Check to see if we are even doing the Puzzle |
| 1143 | if (Var_ThereIsPlayerInPriestKeyPuzzle == 0) { |
| 1144 | return; // don't even bother processesing |
| 1145 | } |
| 1146 | |
| 1147 | if (Var_PriestPuzzleCompleted > 0) { |
| 1148 | return; // puzzle solved |
| 1149 | } |
| 1150 | |
| 1151 | // Check to see if the Player has changed rooms, if not we can bail |
| 1152 | int Player_room; |
| 1153 | Player_room = qObjRoom(Var_SavedObject); |
| 1154 | |
| 1155 | if (Var_PriestPlayerCurrentRoom == Player_room) { |
| 1156 | return; // hasn't changed room yet |
| 1157 | } |
| 1158 | |
| 1159 | // Quick hack to see if he moved from PPathOrigin to PPath1 |
| 1160 | if (Player_room == PriestKeyRoomMap[4][2] && Var_PriestPlayerCurrentRoom == PriestKeySafeRoom) { |
| 1161 | PriestPlaySoundAtNode(1); |
| 1162 | Var_PriestPlayerCurrNode = 0; |
| 1163 | Var_PriestPlayerCurrentRoom = PriestKeyRoomMap[4][2]; |
| 1164 | } |
| 1165 | |
| 1166 | // What node are we currently at? |
| 1167 | if (Var_PriestPlayerCurrNode == -1) { |
| 1168 | // this means they goofed or just starting |
| 1169 | if (Player_room == PriestKeySafeRoom) { |
| 1170 | // they are back at the safe room, reset the puzzle |
| 1171 | PriestResetPuzzle(); |
| 1172 | } |
| 1173 | return; |
| 1174 | } |
| 1175 | |
| 1176 | if (Var_PriestPlayerCurrNode == 16) { |
| 1177 | // this means the player finished the puzzle |
| 1178 | return; |
| 1179 | } |
| 1180 | |
| 1181 | if (Var_PriestPlayerCurrNode < 0 || Var_PriestPlayerCurrNode > 15) { |
| 1182 | // invalid |
| 1183 | Var_PriestPlayerCurrNode = -1; |
| 1184 | return; |
| 1185 | } |
| 1186 | |
| 1187 | // Create list of bad rooms, and the good room |
| 1188 | int BadRooms[3]; |
| 1189 | int GoodRoom; |
| 1190 | int num_BadRooms = 0; |
| 1191 | int curr_x, curr_y; |
| 1192 | curr_x = PriestCorrectPath[Var_PriestPlayerCurrNode].x; |
| 1193 | curr_y = PriestCorrectPath[Var_PriestPlayerCurrNode].y; |
| 1194 | |
| 1195 | GoodRoom = PriestKeyRoomMap[PriestCorrectPath[Var_PriestPlayerCurrNode + 1].y] |
no test coverage detected