| 1 |
/* |
| 2 |
* |
| 3 |
* Copyright (C) 2006 The Exult Team |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 |
* |
| 19 |
* |
| 20 |
* This source file contains usecode for the Keyring Quest. |
| 21 |
* Specifically, it contains a cutscene where Zauiel makes |
| 22 |
* the Blackrock potion. |
| 23 |
* |
| 24 |
* Author: Marzo Junior |
| 25 |
* Last Modified: 2006-02-27 |
| 26 |
*/ |
| 27 |
|
| 28 |
enum MakePotion_levels { |
| 29 |
CAST_TELEPORT = 1, |
| 30 |
TELEPORT_WIDGETS = 2, |
| 31 |
POTION_FADE_SCREEN = 3, |
| 32 |
MOVE_TO_LAB = 4, |
| 33 |
POTION_UNFADE_SCREEN = 5, |
| 34 |
MAKE_POTION = 6, |
| 35 |
PLACE_BLACKROCK = 7, |
| 36 |
UPDATE_CAULDRON = 8, |
| 37 |
DELETE_POTIONS = 9, |
| 38 |
BEGIN_DIALOG_1 = 10, |
| 39 |
MOVE_TO_LBCASTLE = 11, |
| 40 |
BEGIN_DIALOG_2 = 12, |
| 41 |
TELEPORT_TO_SKARABRAE = 13, |
| 42 |
WALK_TO_CAULDRON_1 = 14, |
| 43 |
WALK_TO_CAULDRON_2 = 15, |
| 44 |
WALK_TO_POTION_1 = 16, |
| 45 |
WALK_TO_POTION_2 = 17, |
| 46 |
IS_AT_CAULDRON_1 = 18, |
| 47 |
IS_AT_CAULDRON_2 = 19, |
| 48 |
IS_AT_POTION_1 = 20, |
| 49 |
IS_AT_POTION_2 = 21 |
| 50 |
}; |
| 51 |
|
| 52 |
void zaurielMakePotion object#() () { |
| 53 |
struct<Position> pos; |
| 54 |
var party = UI_get_party_list(); |
| 55 |
var casting; |
| 56 |
|
| 57 |
if (event == CAST_TELEPORT) { |
| 58 |
//item = ZAURIEL |
| 59 |
ZAURIEL->show_npc_face(0); |
| 60 |
say("@I shall teleport us all into my lab so that we have some privacy while I work on the potion.@"); |
| 61 |
//Teleportation spell: |
| 62 |
script item { |
| 63 |
nohalt; |
| 64 |
finish; |
| 65 |
face south; |
| 66 |
call showCastingFrames; |
| 67 |
actor frame cast_up; |
| 68 |
wait 2; |
| 69 |
say "@Vas In Por@"; |
| 70 |
next frame; |
| 71 |
wait 2; |
| 72 |
previous frame; |
| 73 |
wait 2; |
| 74 |
next frame; |
| 75 |
wait 2; |
| 76 |
previous frame; |
| 77 |
sfx SOUND_TELEPORT; |
| 78 |
call zaurielMakePotion, TELEPORT_WIDGETS; |
| 79 |
wait 8; |
| 80 |
call zaurielMakePotion, POTION_FADE_SCREEN; |
| 81 |
actor frame standing; |
| 82 |
wait 5; |
| 83 |
call zaurielMakePotion, MOVE_TO_LAB; |
| 84 |
} |
| 85 |
abort; |
| 86 |
} else if (event == TELEPORT_WIDGETS) { |
| 87 |
//item = ZAURIEL |
| 88 |
//The spell effect animation: |
| 89 |
pos = get_object_position(); |
| 90 |
UI_sprite_effect(ANIMATION_TELEPORT, pos.x, pos.y, 0, 0, 0, -1); |
| 91 |
for (npc in party) { |
| 92 |
pos = npc->get_object_position(); |
| 93 |
UI_sprite_effect(ANIMATION_TELEPORT, pos.x, pos.y, 0, 0, 0, -1); |
| 94 |
} |
| 95 |
} else if (event == POTION_FADE_SCREEN) { |
| 96 |
//Fade to black: |
| 97 |
UI_fade_palette(12, 1, 0); |
| 98 |
} else if (event == MOVE_TO_LAB) { |
| 99 |
//item = ZAURIEL |
| 100 |
//Move Zauriel |
| 101 |
move_object([0x535, 0xA47, 0x0]); |
| 102 |
set_item_frame_rot(STAND_EAST); |
| 103 |
|
| 104 |
//Use the Avatar to unfade the screen: |
| 105 |
script AVATAR { |
| 106 |
face west; |
| 107 |
wait 2; |
| 108 |
call zaurielMakePotion, POTION_UNFADE_SCREEN; |
| 109 |
wait 5; |
| 110 |
call zaurielMakePotion, MAKE_POTION; |
| 111 |
} |
| 112 |
//Move the party: |
| 113 |
pos = [0x53D, 0xA46, 0x0]; |
| 114 |
PARTY->move_object(pos); |
| 115 |
} else if (event == POTION_UNFADE_SCREEN) { |
| 116 |
//Unfade from black: |
| 117 |
UI_fade_palette(12, 1, 1); |
| 118 |
} else if (event == MAKE_POTION) { |
| 119 |
script AVATAR after 2 ticks call trueFreeze; |
| 120 |
|
| 121 |
ZAURIEL->show_npc_face(0); |
| 122 |
say("@There, I can work unfettered by other concerns now. Here, let me have the ingredients.@"); |
| 123 |
//Take the ingredients away: |
| 124 |
UI_remove_party_items(1, SHAPE_BLACKROCK, QUALITY_ANY, FRAME_ANY, true); |
| 125 |
UI_remove_party_items(1, SHAPE_VENOM, QUALITY_ANY, FRAME_ANY, true); |
| 126 |
say("Zauriel takes the Blackrock and the Silver Serpent venom from you. @Thank thee, Avatar.@"); |
| 127 |
//The cutscene: |
| 128 |
script ZAURIEL after 3 ticks { |
| 129 |
nohalt; |
| 130 |
finish; |
| 131 |
call zaurielMakePotion, WALK_TO_CAULDRON_1; |
| 132 |
} |
| 133 |
|
| 134 |
} else if (event >= WALK_TO_CAULDRON_1 && event <= WALK_TO_POTION_2) { |
| 135 |
var pos = [0x537, 0xa46, 0x0]; |
| 136 |
var newevent; |
| 137 |
switch (event) { |
| 138 |
case WALK_TO_CAULDRON_1: |
| 139 |
newevent = IS_AT_CAULDRON_1; |
| 140 |
break; |
| 141 |
case WALK_TO_CAULDRON_2: |
| 142 |
newevent = IS_AT_CAULDRON_2; |
| 143 |
break; |
| 144 |
case WALK_TO_POTION_1: |
| 145 |
pos = [0x534, 0xa47, 0x0]; |
| 146 |
newevent = IS_AT_POTION_1; |
| 147 |
break; |
| 148 |
case WALK_TO_POTION_2: |
| 149 |
pos = [0x534, 0xa49, 0x0]; |
| 150 |
newevent = IS_AT_POTION_2; |
| 151 |
break; |
| 152 |
} |
| 153 |
ZAURIEL->si_path_run_usecode(pos, newevent, ZAURIEL, zaurielMakePotion, true); |
| 154 |
} else if (event >= IS_AT_CAULDRON_1 && event <= IS_AT_POTION_2) { |
| 155 |
if (event <= IS_AT_CAULDRON_2) { |
| 156 |
if (event == IS_AT_CAULDRON_1) { |
| 157 |
script ZAURIEL { |
| 158 |
nohalt; |
| 159 |
finish; |
| 160 |
actor frame standing; |
| 161 |
face east; |
| 162 |
wait 2; |
| 163 |
actor frame bowing; |
| 164 |
wait 2; |
| 165 |
call zaurielMakePotion, PLACE_BLACKROCK; |
| 166 |
actor frame standing; |
| 167 |
wait 2; |
| 168 |
call zaurielMakePotion, WALK_TO_POTION_1; |
| 169 |
}; |
| 170 |
} else { |
| 171 |
script ZAURIEL { |
| 172 |
nohalt; |
| 173 |
finish; |
| 174 |
actor frame standing; |
| 175 |
face east; |
| 176 |
repeat 3 { |
| 177 |
actor frame standing; |
| 178 |
wait 2; |
| 179 |
actor frame ready; |
| 180 |
wait 2; |
| 181 |
call zaurielMakePotion, UPDATE_CAULDRON; |
| 182 |
}; |
| 183 |
actor frame standing; |
| 184 |
wait 2; |
| 185 |
call zaurielMakePotion, BEGIN_DIALOG_1; |
| 186 |
} |
| 187 |
} |
| 188 |
} else { |
| 189 |
var newevent; |
| 190 |
if (event == IS_AT_POTION_1) { |
| 191 |
newevent = WALK_TO_POTION_2; |
| 192 |
} else { |
| 193 |
newevent = WALK_TO_CAULDRON_2; |
| 194 |
} |
| 195 |
script ZAURIEL { |
| 196 |
nohalt; |
| 197 |
finish; |
| 198 |
actor frame standing; |
| 199 |
face west; |
| 200 |
wait 2; |
| 201 |
actor frame ready; |
| 202 |
wait 2; |
| 203 |
call zaurielMakePotion, DELETE_POTIONS; |
| 204 |
actor frame standing; |
| 205 |
wait 2; |
| 206 |
call zaurielMakePotion, newevent; |
| 207 |
}; |
| 208 |
} |
| 209 |
} else if (event == PLACE_BLACKROCK) { |
| 210 |
var blackrock = UI_create_new_object(SHAPE_BLACKROCK); |
| 211 |
UI_update_last_created([1337, 2630, 2]); |
| 212 |
} else if (event == DELETE_POTIONS) { |
| 213 |
var potions = ZAURIEL->find_nearest(SHAPE_BLACKROCK_POTION, 3); |
| 214 |
potions->remove_item(); |
| 215 |
UI_play_sound_effect(SOUND_KEY); |
| 216 |
} else if (event == UPDATE_CAULDRON) { |
| 217 |
var cauldron = ZAURIEL->find_nearest(SHAPE_CAULDRON, 10); |
| 218 |
var blackrock = ZAURIEL->find_nearest(SHAPE_BLACKROCK, 10); |
| 219 |
var framemap = [ 4, -1, 3, 0, 2]; |
| 220 |
var sfxmap = [67, 67, 67, SOUND_KEY, 67]; |
| 221 |
var frameindex = cauldron->get_item_frame() + 1; |
| 222 |
|
| 223 |
if (blackrock) { |
| 224 |
blackrock->UI_remove_item(); |
| 225 |
} |
| 226 |
if (framemap[frameindex] != 0) { |
| 227 |
UI_sprite_effect(ANIMATION_POOF, 1336, 2629, 0, 0, 0, -1); |
| 228 |
} |
| 229 |
UI_play_sound_effect(sfxmap[frameindex]); |
| 230 |
cauldron->set_item_frame(framemap[frameindex]); |
| 231 |
} else if (event == BEGIN_DIALOG_1) { |
| 232 |
var potion; |
| 233 |
|
| 234 |
ZAURIEL->show_npc_face(0); |
| 235 |
say("Zauriel finally turns to you and hands you the potion. @Here, the potion is ready."); |
| 236 |
say("@Make good use of it, for I shall -not- give thee any more!@ In the vial is a glowing black potion."); |
| 237 |
|
| 238 |
//Try to create the potion in the Avatar's inventory: |
| 239 |
UI_set_last_created(get_cont_items(SHAPE_BLACKROCK_POTION, QUALITY_ANY, FRAME_ANY)); |
| 240 |
if (!AVATAR->give_last_created()) { |
| 241 |
say("@Since thou art so overburdened, I shall place the potion on the ground.@"); |
| 242 |
UI_update_last_created(AVATAR->get_object_position()); |
| 243 |
} |
| 244 |
|
| 245 |
//Remind the player that a piece of Blackrock is still needed: |
| 246 |
var blackrock_count = PARTY->count_objects(SHAPE_BLACKROCK, QUALITY_ANY, FRAME_ANY); |
| 247 |
if (!blackrock_count) { |
| 248 |
say("@Remember that thou dost still need to gather a piece of Blackrock ore in order to neutralize the necklace!@"); |
| 249 |
} |
| 250 |
say("@I shall now tell thee where my daughter is being held.@"); |
| 251 |
add("Where are they?"); |
| 252 |
|
| 253 |
converse (0) { |
| 254 |
case "Where are they?" (remove): |
| 255 |
say("@Yes, I was just about to say that! A little more patience, Avatar, if thou wilt!"); |
| 256 |
say("@There is a small island to the north of Skara Brae; that is where the mage and his thugs are located."); |
| 257 |
say("@My divinations indicate that they are in the northwestern portion of the island."); |
| 258 |
say("@There -is- the issue that the island is disconnected from the mainland, being reachable only by boat or through flying..."); |
| 259 |
say("@But thou art resourceful enough to bypass this minor obstacle.@"); |
| 260 |
gflags[ZAURIEL_TOLD_LOCATION] = true; |
| 261 |
} |
| 262 |
|
| 263 |
say("@Now that everything is said, I shall take us back to where we were.@"); |
| 264 |
//Teleportation animation: |
| 265 |
script item { |
| 266 |
nohalt; |
| 267 |
finish; |
| 268 |
face south; |
| 269 |
call showCastingFrames; |
| 270 |
actor frame cast_up; |
| 271 |
wait 2; |
| 272 |
say "@Vas In Por@"; |
| 273 |
next frame; |
| 274 |
wait 2; |
| 275 |
previous frame; |
| 276 |
wait 2; |
| 277 |
next frame; |
| 278 |
wait 2; |
| 279 |
previous frame; |
| 280 |
sfx SOUND_TELEPORT; |
| 281 |
call zaurielMakePotion, TELEPORT_WIDGETS; |
| 282 |
wait 8; |
| 283 |
call zaurielMakePotion, POTION_FADE_SCREEN; |
| 284 |
actor frame standing; |
| 285 |
wait 5; |
| 286 |
call zaurielMakePotion, MOVE_TO_LBCASTLE; |
| 287 |
} |
| 288 |
abort; |
| 289 |
} else if (event == MOVE_TO_LBCASTLE) { |
| 290 |
//item = ZAURIEL |
| 291 |
AVATAR->trueUnfreeze(); |
| 292 |
//Move Zauriel: |
| 293 |
move_object([0x3A2, 0x4E0, 0x0]); |
| 294 |
set_item_frame_rot(STAND_SOUTH); |
| 295 |
//Use Avatar to unfade screen: |
| 296 |
script AVATAR { |
| 297 |
face north; |
| 298 |
wait 2; |
| 299 |
call zaurielMakePotion, POTION_UNFADE_SCREEN; |
| 300 |
wait 5; |
| 301 |
call zaurielMakePotion, BEGIN_DIALOG_2; |
| 302 |
} |
| 303 |
//Move party: |
| 304 |
pos = [0x3A2, 0x4E6, 0x0]; |
| 305 |
PARTY->move_object(pos); |
| 306 |
} else if (event == BEGIN_DIALOG_2) { |
| 307 |
ZAURIEL->show_npc_face(0); |
| 308 |
say("@Here we are again. Thou knowest now what needs to be done, so I ask thee to do so quickly."); |
| 309 |
say("@But before thou dost go, I must confess that I find this place far too crowded for me."); |
| 310 |
say("@When thou hast rescued my daughter, come meet me near the Skara Brae Moongate."); |
| 311 |
if (PARTY->count_objects(SHAPE_SEXTANT, QUALITY_ANY, FRAME_ANY)) { |
| 312 |
say("@Thy sextant shall guide thee: I shall be at 45 degrees south, 38 degrees west.@"); |
| 313 |
} else { |
| 314 |
say("@Shouldst thou acquire a sextant, take this as a reference: I shall be at 45 degrees south, 38 degrees west.@"); |
| 315 |
} |
| 316 |
|
| 317 |
giveExperience(100); |
| 318 |
//Fire the teleport animation and move Zauriel: |
| 319 |
gflags[ZAURIEL_TELEPORTED] = true; |
| 320 |
struct<Position> pos = ZAURIEL->get_object_position(); |
| 321 |
UI_sprite_effect(ANIMATION_TELEPORT, pos.x, pos.y, 0, 0, 0, -1); |
| 322 |
script ZAURIEL { |
| 323 |
nohalt; |
| 324 |
say "@Meet me near Skara Brae!@"; |
| 325 |
sfx SOUND_TELEPORT; |
| 326 |
wait 6; |
| 327 |
call zaurielMakePotion, TELEPORT_TO_SKARABRAE; |
| 328 |
} |
| 329 |
} else if (event == TELEPORT_TO_SKARABRAE) { |
| 330 |
//Move him to the destination: |
| 331 |
move_object([0x224, 0x630, 0x0]); |
| 332 |
set_item_frame_rot(STAND_SOUTH); |
| 333 |
set_new_schedules([DAWN, MORNING, AFTERNOON, EVENING, NIGHT], |
| 334 |
[WAIT, WAIT, WAIT, WAIT, WAIT], |
| 335 |
[0x224, 0x630, 0x224, 0x630, 0x224, 0x630, 0x224, 0x630, 0x224, 0x630]); |
| 336 |
} |
| 337 |
} |