| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
import adonthell |
| 16 |
import events |
| 17 |
|
| 18 |
|
| 19 |
def N_(message): return message |
| 20 |
def _(message): return adonthell.nls_translate (message) |
| 21 |
|
| 22 |
class extro(object): |
| 23 |
def __init__(self, mapchar): |
| 24 |
|
| 25 |
adonthell.audio_set_schedule_active (False) |
| 26 |
adonthell.audio_fade_out_background (1000) |
| 27 |
|
| 28 |
|
| 29 |
bjarn = adonthell.gamedata_get_character ("Bjarn Fingolson") |
| 30 |
erek = adonthell.gamedata_get_character ("Erek Stonebreaker") |
| 31 |
jelom = adonthell.gamedata_get_character ("Jelom Rasgar") |
| 32 |
talan = adonthell.gamedata_get_character ("Talan Wendth") |
| 33 |
silverhair = adonthell.gamedata_get_character ("Imoen Silverhair") |
| 34 |
player = adonthell.gamedata_player () |
| 35 |
|
| 36 |
talan.pause () |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
self.text = [(bjarn, N_("There is no denying it. Yes, I feigned the theft. ")), \ |
| 41 |
(erek, N_("But Master? How could you do such an infamous deed? ")), \ |
| 42 |
(jelom, N_("That I would know as well! And where are the gems then? ")), \ |
| 43 |
(bjarn, N_("What? Haven't I made myself clear already? ")), \ |
| 44 |
(bjarn, N_("I despise those Elves and their uncanny ways. ")), \ |
| 45 |
(bjarn, N_("Their ... meddling with reality contradicts all principles I learnt to hold true. ")), \ |
| 46 |
(bjarn, N_("And yet, I had to provide them with the reagents they need to perform their dark art. ")), \ |
| 47 |
(bjarn, N_("I felt so ... ashamed! ")), \ |
| 48 |
(player, N_("And you believe this justifies the discomfort you caused my mistress? ")), \ |
| 49 |
(bjarn, N_("You cannot think further than your mistress, can you? ")), \ |
| 50 |
(bjarn, N_("Theft by a high born like Lady Silverhair would have been considered a grave insult by the clan elders. ")), \ |
| 51 |
(bjarn, N_("Had she been convicted, they might have chosen to cease trading with her likes. ")), \ |
| 52 |
(bjarn, N_("It might have been years before any Elf got his filthy hands on our beloved gems again! ")), \ |
| 53 |
(silverhair, N_("I feared as much and I feared the consequences.")), \ |
| 54 |
(silverhair, N_("Without the arcane arts my kind would soon succumb to the human tides. ")), \ |
| 55 |
(silverhair, N_("But without gems and ores purchased from the small folk we cannot create magic. ")), \ |
| 56 |
(jelom, N_("Who would have thought that? ")), \ |
| 57 |
(jelom, _("Seems you owe %s here a big favour, if I may say so, Lady. ") % player.get_name()), \ |
| 58 |
(silverhair, _("Rest assured that %s's deeds will not be forgotten, good man. ") % player.get_name()), \ |
| 59 |
(jelom, N_("Well, this is settled then. What remains now are the whereabouts of the gems. ")), \ |
| 60 |
(jelom, N_("Master Fingolson! ")), \ |
| 61 |
(None, N_("They were here all the time, safe from thieving hands, ...")), \ |
| 62 |
(None, N_("... well hidden in a niche I carved during my previous visits.")), \ |
| 63 |
(None, N_("Right here.")), \ |
| 64 |
(None, N_("But ...")), \ |
| 65 |
(None, N_("... they are gone!")), \ |
| 66 |
(talan, N_("Sir, sir! To the gate! Quick! The thief is loose!")), \ |
| 67 |
(bjarn, N_("My jewels, oh my jewels!")), \ |
| 68 |
(player, N_("By Andomiel's Tree! What happened to you, Talan?!")), \ |
| 69 |
(talan, N_("It was the mercenary, sir! He sneaked upon me and hit me over the head.")), \ |
| 70 |
(silverhair, N_("O sweet irony.")), \ |
| 71 |
(jelom, N_("Then the gems have been stolen after all?!")), \ |
| 72 |
(jelom, N_("By that scum, Alek!? Now that's funny.")), \ |
| 73 |
(bjarn, N_("How can you say that? And why are you still here?")), \ |
| 74 |
(bjarn, N_("Will nobody go after my gems!?")), \ |
| 75 |
(jelom, N_("What for?")), \ |
| 76 |
(jelom, N_("Where you are going you won't need them any more. Besides, Alek is probably long gone by now ..."))] |
| 77 |
|
| 78 |
|
| 79 |
self.typeover = [_("And so Alek Endhelm escaped into the\nNorth, where he spent his newly gained\nwealth for Ale and other pleasures."), \ |
| 80 |
_("Bjarn Fingolson however, bereft of all\nhonour, was taken to Uzdun'kal and\nsentenced to the lowest labour.\nNowadays his fate serves as an example\nand a warning to generations of young Dwarves."), \ |
| 81 |
_("Lady Imoen Silverhair received the finest\nChrysoberyl Catseyes as a token of\nregret, and the magic rings and amulets\nshe crafted were of wondrous might and\nbeauty, desired and admired throughout\nthe realm."), \ |
| 82 |
_("Soon after his return, young Erek\naccomplished the Rite of Passage and\njoined adult society. To his surprise, he\nwas sent to the Elvish Council at the\nHigh City of Elgilad, as an ambassador\nfor his people.")] |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
self.credits = [("Adonthell", 1), \ |
| 87 |
("- Waste's Edge -", 3), \ |
| 88 |
(_("directed by:"), 1), \ |
| 89 |
("Alexandre Courbot", 1), \ |
| 90 |
("Kai Sterker", 3), \ |
| 91 |
(_("written by:"), 1), \ |
| 92 |
("Kai Sterker", 1), \ |
| 93 |
("Mike Nieforth", 1), \ |
| 94 |
("Josh Glover", 3), \ |
| 95 |
(_("based on an original idea by:"), 1), \ |
| 96 |
("Kai Sterker", 3), \ |
| 97 |
(_("produced by:"), 1), \ |
| 98 |
(_("the Adonthell team"), 3), \ |
| 99 |
(_("executive producers:"), 1), \ |
| 100 |
("Sourceforge.net", 1), \ |
| 101 |
("GNU Savannah", 1), \ |
| 102 |
("Linuxgames.com", 5), \ |
| 103 |
(_("cast:"), 1), \ |
| 104 |
(adonthell.gamedata_player ().get_name () + _(" - you"), 1), \ |
| 105 |
(_("Imoen Silverhair - herself"), 1), \ |
| 106 |
(_("Bjarn Fingolson - himself"), 1), \ |
| 107 |
(_("Erek Stonebreaker - himself"), 1), \ |
| 108 |
(_("Orloth Redwyne - himself"), 1), \ |
| 109 |
(_("Alek Endhelm - himself"), 1), \ |
| 110 |
(_("Oliver Redwyne - himself"), 1), \ |
| 111 |
(_("Talan Wendth - himself"), 1), \ |
| 112 |
(_("Jelom Rasgar - himself"), 1), \ |
| 113 |
(_("Tristan Illig - himself"), 1), \ |
| 114 |
(_("Fellnir Kezular - himself"), 1), \ |
| 115 |
(_("Lucia Redwyne - herself"), 1), \ |
| 116 |
(_("Rhayne Frostbloom - herself"), 1), \ |
| 117 |
(_("Sarin Trailfollower - himself"), 1), \ |
| 118 |
(_("Janesta Skywind - herself"), 2), \ |
| 119 |
(_("Mrs. Frostbloom's assistant:"), 1), \ |
| 120 |
("Yeti", 2), \ |
| 121 |
(_("casting:"), 1), \ |
| 122 |
("Benjamin Walther-Franks", 5), \ |
| 123 |
(_("director of photography:"), 1), \ |
| 124 |
("Alexandre Courbot", 2), \ |
| 125 |
(_("art director:"), 1), \ |
| 126 |
("James Nash", 2), \ |
| 127 |
(_("assistant art director:"), 1), \ |
| 128 |
("Benjamin Walther-Franks", 2), \ |
| 129 |
(_("wardrobe:"), 1), \ |
| 130 |
("Benjamin Walther-Franks", 2), \ |
| 131 |
(_("props masters:"), 1), \ |
| 132 |
("James Nash", 1), \ |
| 133 |
("Kai Sterker", 2), \ |
| 134 |
(_("location managers:"), 1), \ |
| 135 |
("Alexandre Courbot", 1), \ |
| 136 |
("James Nash", 2), \ |
| 137 |
(_("grip:"), 1), \ |
| 138 |
("Alexandre Courbot", 5), \ |
| 139 |
(_("\"Window\" unit:"), 2), \ |
| 140 |
(_("director:"), 1), \ |
| 141 |
("Joel Vennin", 2), \ |
| 142 |
(_("assistant director:"), 1), \ |
| 143 |
("Joel Vennin", 2), \ |
| 144 |
(_("best boy:"), 1), \ |
| 145 |
("Yeti", 2), \ |
| 146 |
(_("runner:"), 1), \ |
| 147 |
("Joel Vennin", 5), \ |
| 148 |
(_("music by:"), 1), \ |
| 149 |
("Joseph Toscano", 2), \ |
| 150 |
(_("foley artist:"), 1), \ |
| 151 |
("Joseph Toscano", 2), \ |
| 152 |
(_("title design:"), 1), \ |
| 153 |
("John Havard", 1), \ |
| 154 |
("James Nash", 3), \ |
| 155 |
(_("soundtrack available on:"), 1), \ |
| 156 |
("http://bandcamp.zhaytee.net", 7), \ |
| 157 |
(_("the Adonthell team wishes to thank:"), 2), \ |
| 158 |
("Al Koskelin", 1), \ |
| 159 |
("Andrew Henderson", 1), \ |
| 160 |
("Chris Harris", 1), \ |
| 161 |
("Mark Howson", 1), \ |
| 162 |
("Dave Peticolas", 1), \ |
| 163 |
("Ryan O'Neil", 1), \ |
| 164 |
("Meandus", 1), \ |
| 165 |
("Deniz Oezsen", 2), \ |
| 166 |
(_("The people behind SDL, Ogg Vorbis,"), 1), \ |
| 167 |
(_("Python, SWIG and all the other Free"), 1), \ |
| 168 |
(_("Software developers whose work"), 1), \ |
| 169 |
(_("made Adonthell possible"), 3), \ |
| 170 |
(_("career portal:"), 1), \ |
| 171 |
("http://adonthell.nongnu.org", 6), \ |
| 172 |
(_("No Yetis were harmed during\n the production of this game"), 5), \ |
| 173 |
(_("presented in"), 3), \ |
| 174 |
(_("Ogg Vorbis Stereo"), 1), \ |
| 175 |
(_("(where available)"), 14), \ |
| 176 |
(_("The END"), 6), \ |
| 177 |
(_("Joel, you are fired! ;)"), -1)] |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
self.colors = ["white", "yellow", "red", "violet", "blue", "green"] |
| 182 |
|
| 183 |
|
| 184 |
self.index = 0 |
| 185 |
self.bubble = self.make_bubble () |
| 186 |
self.done = 0 |
| 187 |
|
| 188 |
|
| 189 |
self.wall = adonthell.win_image () |
| 190 |
self.wall.load_raw ('gfx/cutscene/extro_wall.img') |
| 191 |
self.wall.pack () |
| 192 |
self.wall.thisown = 0 |
| 193 |
|
| 194 |
self.chest = adonthell.win_image () |
| 195 |
self.chest.load_raw ('gfx/cutscene/extro_chest.img') |
| 196 |
self.chest.set_mask (True) |
| 197 |
self.chest.move (75, 0) |
| 198 |
self.chest.pack () |
| 199 |
self.chest.thisown = 0 |
| 200 |
|
| 201 |
self.o_bag = adonthell.win_image () |
| 202 |
self.o_bag.load_raw ('gfx/cutscene/extro_open_bag.img') |
| 203 |
self.o_bag.pack () |
| 204 |
self.o_bag.thisown = 0 |
| 205 |
|
| 206 |
self.c_bag = adonthell.win_image () |
| 207 |
self.c_bag.load_raw ('gfx/cutscene/extro_closed_bag.img') |
| 208 |
self.c_bag.pack () |
| 209 |
self.c_bag.thisown = 0 |
| 210 |
|
| 211 |
self.bjarn = adonthell.win_image () |
| 212 |
self.bjarn.load_raw ('gfx/cutscene/extro_bjarn.img') |
| 213 |
self.bjarn.pack () |
| 214 |
self.bjarn.thisown = 0 |
| 215 |
|
| 216 |
self.skipping = False |
| 217 |
|
| 218 |
|
| 219 |
adonthell.audio_load_background (0, "audio/at-demo-9.ogg") |
| 220 |
adonthell.audio_play_background (0) |
| 221 |
|
| 222 |
def run (self): |
| 223 |
|
| 224 |
if self.index == 0: |
| 225 |
adonthell.gamedata_engine ().set_control_active (False) |
| 226 |
|
| 227 |
|
| 228 |
elif self.index == 20: |
| 229 |
bjarn = self.text[3][0] |
| 230 |
if self.done == 0: |
| 231 |
bjarn.set_goal (7, 3, adonthell.STAND_NORTH) |
| 232 |
self.done = 1 |
| 233 |
|
| 234 |
if (bjarn.follow_path () == 0): |
| 235 |
return |
| 236 |
else: |
| 237 |
adonthell.gamedata_player ().set_schedule_active (False) |
| 238 |
self.index = self.index + 1 |
| 239 |
self.zoom_to_chest () |
| 240 |
return |
| 241 |
|
| 242 |
|
| 243 |
elif self.index == 25 and self.done == 0: |
| 244 |
bjarn = self.text[3][0] |
| 245 |
bjarn.go_south () |
| 246 |
bjarn.load ('bjarn_crying.mchar') |
| 247 |
|
| 248 |
talan = adonthell.gamedata_get_character ('Talan Wendth') |
| 249 |
talan.load ("talan_beaten.mchar") |
| 250 |
events.switch_submap (talan, 7, 1, 6, adonthell.STAND_EAST) |
| 251 |
|
| 252 |
|
| 253 |
adonthell.gamedata_get_character ("Erek Stonebreaker").stand_west () |
| 254 |
adonthell.gamedata_get_character ("Jelom Rasgar").stand_west () |
| 255 |
adonthell.gamedata_get_character ("Imoen Silverhair").stand_west () |
| 256 |
adonthell.gamedata_player ().stand_west () |
| 257 |
|
| 258 |
talan.go_east () |
| 259 |
talan.stand_south () |
| 260 |
self.done = 1 |
| 261 |
|
| 262 |
elif self.index == 36 and self.bubble == None: |
| 263 |
|
| 264 |
adonthell.gamedata_player ().set_schedule_active (False) |
| 265 |
adonthell.gamedata_engine ().fade_out () |
| 266 |
adonthell.gamedata_engine ().mapview_stop () |
| 267 |
self.fade_to_forest () |
| 268 |
return |
| 269 |
|
| 270 |
if self.bubble == None: |
| 271 |
self.index = self.index + 1 |
| 272 |
self.bubble = self.make_bubble () |
| 273 |
self.done = 0 |
| 274 |
|
| 275 |
|
| 276 |
def make_bubble (self): |
| 277 |
(npc, text) = self.text[self.index] |
| 278 |
length = len(text) + 110 |
| 279 |
|
| 280 |
if npc != None: |
| 281 |
|
| 282 |
color = self.colors[npc.get_color ()] |
| 283 |
|
| 284 |
|
| 285 |
view = adonthell.gamedata_engine ().get_mapview () |
| 286 |
area = adonthell.gamedata_engine ().get_landmap ().get_submap (7) |
| 287 |
|
| 288 |
offx = 0 |
| 289 |
offy = 0 |
| 290 |
|
| 291 |
if area.area_length () * 20 < view.length (): |
| 292 |
offx = (view.length () - area.area_length () * 20) // 2 |
| 293 |
if ((area.area_height() * 20) < view.height()): |
| 294 |
offy = (view.height () - area.area_height() * 20) // 2 |
| 295 |
|
| 296 |
x = (npc.posx () - view.posx ()) * 20 + offx + 10 - length // 2 |
| 297 |
y = (npc.posy () - view.posy ()) * 20 + offy - 15 |
| 298 |
else: |
| 299 |
color = 'red' |
| 300 |
|
| 301 |
|
| 302 |
bubble = adonthell.text_bubble (text, color, 'original', length) |
| 303 |
bubble.thisown = 0 |
| 304 |
|
| 305 |
|
| 306 |
if npc != None: |
| 307 |
bubble.move (x, y - bubble.height ()) |
| 308 |
else: |
| 309 |
bubble.move (160 - bubble.length () // 2, 20) |
| 310 |
|
| 311 |
|
| 312 |
bubble.set_visible (True) |
| 313 |
adonthell.win_manager_get_active ().add (bubble) |
| 314 |
|
| 315 |
bubble.py_signal_connect (self.on_close_bubble, adonthell.win_event_CLOSE) |
| 316 |
return bubble |
| 317 |
|
| 318 |
|
| 319 |
def on_close_bubble (self, retval): |
| 320 |
self.bubble = None |
| 321 |
|
| 322 |
|
| 323 |
def zoom_to_chest (self): |
| 324 |
self.window = adonthell.win_container () |
| 325 |
self.window.move (0, 0) |
| 326 |
self.window.resize (320, 240) |
| 327 |
self.window.set_visible_border (False) |
| 328 |
self.window.add (self.wall) |
| 329 |
self.window.add (self.chest) |
| 330 |
self.window.set_activate (True) |
| 331 |
self.window.set_visible_all (True) |
| 332 |
self.window.py_signal_connect (self.on_draw, adonthell.win_event_UPDATE) |
| 333 |
|
| 334 |
self.draw_func = self.move_chest |
| 335 |
self.step = 0 |
| 336 |
self.done = 1 |
| 337 |
|
| 338 |
if self.bubble != None: |
| 339 |
adonthell.win_manager_get_active ().remove (self.bubble) |
| 340 |
self.bubble = None |
| 341 |
|
| 342 |
adonthell.gamedata_engine ().main (self.window, 'fmv') |
| 343 |
|
| 344 |
def on_draw (self): |
| 345 |
if self.draw_func != None: |
| 346 |
self.draw_func () |
| 347 |
|
| 348 |
|
| 349 |
def move_chest (self): |
| 350 |
if self.step == 0: |
| 351 |
|
| 352 |
self.bubble = self.make_bubble () |
| 353 |
self.step = 1 |
| 354 |
return |
| 355 |
|
| 356 |
|
| 357 |
elif self.step <= 80: |
| 358 |
self.step = self.step + 1 |
| 359 |
return |
| 360 |
|
| 361 |
|
| 362 |
elif self.step == 81: |
| 363 |
offset = -1 |
| 364 |
if self.chest.x () <= 65: self.step = 82 |
| 365 |
|
| 366 |
elif self.step == 82: |
| 367 |
offset = 2 |
| 368 |
if self.chest.x () >= 70: self.step = 83 |
| 369 |
|
| 370 |
elif self.step == 83: |
| 371 |
offset = -1 |
| 372 |
if self.chest.x () <= 55: self.step = 84 |
| 373 |
|
| 374 |
elif self.step == 84: |
| 375 |
offset = 2 |
| 376 |
if self.chest.x () >= 65: self.step = 85 |
| 377 |
|
| 378 |
|
| 379 |
elif self.step == 85: |
| 380 |
offset = -1 |
| 381 |
if self.chest.x () <= 20: self.step = 86 |
| 382 |
|
| 383 |
elif self.step == 86: |
| 384 |
offset = -2 |
| 385 |
if self.chest.x () <= -160: self.step = 87 |
| 386 |
|
| 387 |
elif self.step == 87: |
| 388 |
offset = -1 |
| 389 |
if self.chest.x () <= -200: self.step = 88 |
| 390 |
|
| 391 |
|
| 392 |
elif self.step == 88: |
| 393 |
offset = 2 |
| 394 |
if self.chest.x () >= -185: self.step = 89 |
| 395 |
|
| 396 |
elif self.step == 89: |
| 397 |
offset = 1 |
| 398 |
if self.chest.x () >= -175: self.step = 90 |
| 399 |
|
| 400 |
else: |
| 401 |
self.draw_func = self.show_niche |
| 402 |
self.step = 0 |
| 403 |
return |
| 404 |
|
| 405 |
self.chest.move (self.chest.x () + offset, 0) |
| 406 |
return |
| 407 |
|
| 408 |
|
| 409 |
def show_niche (self): |
| 410 |
if self.step == 0 and self.bubble == None: |
| 411 |
self.step = 1 |
| 412 |
self.index = self.index + 1 |
| 413 |
|
| 414 |
self.bubble = self.make_bubble () |
| 415 |
|
| 416 |
|
| 417 |
elif self.step == 1: |
| 418 |
self.c_bag.set_alpha (1) |
| 419 |
self.c_bag.set_visible (True) |
| 420 |
self.window.add (self.c_bag) |
| 421 |
self.step = self.step + 1 |
| 422 |
|
| 423 |
elif self.step > 1 and self.step <= 255: |
| 424 |
self.c_bag.set_alpha (self.step) |
| 425 |
self.step = self.step + 1 |
| 426 |
return |
| 427 |
|
| 428 |
|
| 429 |
elif self.step == 256: |
| 430 |
self.window.remove (self.chest) |
| 431 |
self.window.remove (self.wall) |
| 432 |
del self.chest |
| 433 |
del self.wall |
| 434 |
self.step = 257 |
| 435 |
|
| 436 |
elif self.step > 256 and self.step <= 306: |
| 437 |
self.step = self.step + 1 |
| 438 |
return |
| 439 |
|
| 440 |
elif self.step == 307 and self.bubble == None: |
| 441 |
self.step = 308 |
| 442 |
self.index = self.index + 1 |
| 443 |
|
| 444 |
self.bubble = self.make_bubble () |
| 445 |
|
| 446 |
|
| 447 |
elif self.step == 308: |
| 448 |
self.o_bag.set_alpha (3) |
| 449 |
self.o_bag.set_visible (True) |
| 450 |
self.window.add (self.o_bag) |
| 451 |
self.step = self.step + 1 |
| 452 |
|
| 453 |
elif self.step > 308 and self.step <= 561: |
| 454 |
self.o_bag.set_alpha (self.step - 307) |
| 455 |
self.step = self.step + 1 |
| 456 |
|
| 457 |
elif self.step == 562: |
| 458 |
adonthell.audio_fade_out_background (500) |
| 459 |
self.step = self.step + 1 |
| 460 |
|
| 461 |
|
| 462 |
elif self.step > 562 and self.step <= 650: |
| 463 |
self.step = self.step + 1 |
| 464 |
|
| 465 |
|
| 466 |
elif self.step == 651 and adonthell.audio_is_background_finished(): |
| 467 |
|
| 468 |
adonthell.audio_load_background (1, "audio/at-demo-a.ogg") |
| 469 |
adonthell.audio_play_background (1) |
| 470 |
|
| 471 |
self.bjarn.set_visible (True) |
| 472 |
self.window.add (self.bjarn) |
| 473 |
self.window.remove (self.c_bag) |
| 474 |
self.window.remove (self.o_bag) |
| 475 |
del self.c_bag |
| 476 |
del self.o_bag |
| 477 |
|
| 478 |
self.step = 652 |
| 479 |
self.index = self.index + 1 |
| 480 |
|
| 481 |
self.bubble = self.make_bubble () |
| 482 |
|
| 483 |
elif self.step == 652 and self.bubble == None: |
| 484 |
self.step = 653 |
| 485 |
self.index = self.index + 1 |
| 486 |
|
| 487 |
self.bubble = self.make_bubble () |
| 488 |
|
| 489 |
|
| 490 |
elif self.step > 652 and self.step <= 850: |
| 491 |
if self.bubble == None: self.step = self.step + 1 |
| 492 |
|
| 493 |
elif self.step == 851: |
| 494 |
if self.bubble != None: |
| 495 |
adonthell.win_manager_get_active ().remove (self.bubble) |
| 496 |
self.bubble = None |
| 497 |
adonthell.gamedata_engine ().main_quit () |
| 498 |
adonthell.gamedata_player ().set_schedule_active (True) |
| 499 |
self.done = 0 |
| 500 |
self.index = 25 |
| 501 |
|
| 502 |
|
| 503 |
def fade_to_forest (self): |
| 504 |
|
| 505 |
|
| 506 |
self.da = adonthell.drawing_area () |
| 507 |
self.da.resize (adonthell.screen_length (), adonthell.screen_height ()) |
| 508 |
self.da.move (0, 0) |
| 509 |
|
| 510 |
|
| 511 |
self.wood1 = adonthell.image () |
| 512 |
self.wood1.load_raw ("gfx/cutscene/forest3.img") |
| 513 |
|
| 514 |
self.wood2 = adonthell.image () |
| 515 |
self.wood2.load_raw ("gfx/cutscene/forest2.img") |
| 516 |
self.wood2.set_mask (True) |
| 517 |
|
| 518 |
self.wood3 = adonthell.image () |
| 519 |
self.wood3.load_raw ("gfx/cutscene/forest1.img") |
| 520 |
self.wood3.set_mask (True) |
| 521 |
|
| 522 |
self.alek_run = adonthell.animation () |
| 523 |
self.alek_run.load ("gfx/cutscene/running_alek.anim") |
| 524 |
self.alek_run.play () |
| 525 |
|
| 526 |
self.black = adonthell.win_image () |
| 527 |
self.black.resize (320, 240) |
| 528 |
self.black.fillrect (0, 0, 320, 240, 0) |
| 529 |
self.black.thisown = 0 |
| 530 |
self.black.pack () |
| 531 |
|
| 532 |
|
| 533 |
self.label = adonthell.win_label () |
| 534 |
self.label.set_font (adonthell.win_manager_get_font ("white")) |
| 535 |
self.label.resize (240, 90) |
| 536 |
self.label.move (40, 30) |
| 537 |
self.label.thisown = 0 |
| 538 |
self.label.pack () |
| 539 |
|
| 540 |
|
| 541 |
self.window = adonthell.win_container () |
| 542 |
self.window.move (0, 0) |
| 543 |
self.window.resize (320, 240) |
| 544 |
self.window.thisown = 0 |
| 545 |
self.window.set_visible_border (False) |
| 546 |
self.window.set_trans_background (True) |
| 547 |
|
| 548 |
self.window.add (self.black) |
| 549 |
self.window.add (self.label) |
| 550 |
|
| 551 |
self.window.set_activate (True) |
| 552 |
self.window.set_visible_all (True) |
| 553 |
|
| 554 |
|
| 555 |
adonthell.audio_fade_out_background (500) |
| 556 |
|
| 557 |
|
| 558 |
self.step = 0 |
| 559 |
self.a1 = 0 |
| 560 |
self.a2 = 0 |
| 561 |
self.a3 = 0 |
| 562 |
self.index = 0 |
| 563 |
self.delay = 0 |
| 564 |
self.cursor = 0 |
| 565 |
self.x = [0, 0, 0] |
| 566 |
|
| 567 |
adonthell.gamedata_engine ().set_update_map (False) |
| 568 |
self.letsexit = 0 |
| 569 |
|
| 570 |
adonthell.gametime_update () |
| 571 |
while self.letsexit != 1: |
| 572 |
adonthell.input_update () |
| 573 |
|
| 574 |
for i in range (0, adonthell.gametime_frames_to_skip ()): |
| 575 |
self.forest_animation () |
| 576 |
if self.a3 == 1: |
| 577 |
self.alek_run.update () |
| 578 |
self.window.update () |
| 579 |
|
| 580 |
if self.letsexit != 1: |
| 581 |
self.window.draw () |
| 582 |
adonthell.screen_show () |
| 583 |
adonthell.gametime_update () |
| 584 |
|
| 585 |
adonthell.gamedata_engine ().main (self.window, 'fmv') |
| 586 |
|
| 587 |
|
| 588 |
adonthell.audio_fade_out_background (500) |
| 589 |
adonthell.gamedata_engine ().main_quit () |
| 590 |
|
| 591 |
def forest_animation (self): |
| 592 |
|
| 593 |
if adonthell.input_has_been_pushed (adonthell.SDLK_ESCAPE) or \ |
| 594 |
adonthell.input_has_been_pushed (adonthell.SDLK_SPACE) and \ |
| 595 |
self.skipping == False: |
| 596 |
self.skipping = True |
| 597 |
adonthell.audio_fade_out_background (2000) |
| 598 |
self.window.add (self.black) |
| 599 |
|
| 600 |
|
| 601 |
if self.skipping: |
| 602 |
alpha = self.black.alpha () + 2 |
| 603 |
if alpha <= 255: |
| 604 |
self.black.set_alpha (alpha) |
| 605 |
return |
| 606 |
else: |
| 607 |
self.step = 3 |
| 608 |
self.skipping = False |
| 609 |
|
| 610 |
|
| 611 |
if self.a1 >= 4: |
| 612 |
self.x[0] = self.update_wood (self.wood1, self.x[0]) |
| 613 |
self.a1 = 0 |
| 614 |
else: self.a1 = self.a1 + 1 |
| 615 |
|
| 616 |
|
| 617 |
if self.a2 >= 2: |
| 618 |
self.x[1] = self.update_wood (self.wood2, self.x[1]) |
| 619 |
self.a2 = 0 |
| 620 |
else: self.a2 = self.a2 + 1 |
| 621 |
|
| 622 |
|
| 623 |
if self.a3 >= 1: |
| 624 |
self.x[2] = self.update_wood (self.wood3, self.x[2]) |
| 625 |
self.a3 = 0 |
| 626 |
else: self.a3 = self.a3 + 1 |
| 627 |
|
| 628 |
|
| 629 |
self.draw_wood (self.wood1, self.x[0]) |
| 630 |
self.draw_wood (self.wood2, self.x[1]) |
| 631 |
self.alek_run.draw (110, 120, self.da) |
| 632 |
self.draw_wood (self.wood3, self.x[2]) |
| 633 |
|
| 634 |
|
| 635 |
if self.step == 0: |
| 636 |
alpha = self.black.alpha () - 2 |
| 637 |
if alpha >= 0: |
| 638 |
self.black.set_alpha (alpha) |
| 639 |
return |
| 640 |
else: |
| 641 |
adonthell.audio_load_background (2, "audio/at-demo-2.ogg") |
| 642 |
adonthell.audio_play_background (2) |
| 643 |
|
| 644 |
self.window.remove (self.black) |
| 645 |
self.step = 1 |
| 646 |
|
| 647 |
|
| 648 |
elif self.step == 1: |
| 649 |
if self.index < len (self.typeover): |
| 650 |
if self.cursor < len (self.typeover[self.index]): |
| 651 |
self.delay = self.delay + 1 |
| 652 |
|
| 653 |
if self.delay >= 7: |
| 654 |
if self.cursor == 0: self.label.set_text ("") |
| 655 |
txt = self.typeover[self.index][self.cursor] |
| 656 |
self.label.add_text (txt) |
| 657 |
self.cursor = self.cursor + 1 |
| 658 |
|
| 659 |
|
| 660 |
if txt == '.': self.delay = -50 |
| 661 |
else: self.delay = 0 |
| 662 |
else: |
| 663 |
self.index = self.index + 1 |
| 664 |
self.cursor = 0 |
| 665 |
self.delay = -300 |
| 666 |
else: |
| 667 |
self.delay = 0 |
| 668 |
self.step = 2 |
| 669 |
|
| 670 |
|
| 671 |
elif self.step == 2: |
| 672 |
self.delay = self.delay + 2 |
| 673 |
if self.delay >= 300: |
| 674 |
|
| 675 |
adonthell.audio_fade_out_background (2000) |
| 676 |
self.window.add (self.black) |
| 677 |
self.step = 3 |
| 678 |
|
| 679 |
|
| 680 |
elif self.step == 3: |
| 681 |
alpha = self.black.alpha () + 2 |
| 682 |
if alpha <= 255: |
| 683 |
self.black.set_alpha (alpha) |
| 684 |
return |
| 685 |
else: |
| 686 |
self.letsexit = 1 |
| 687 |
|
| 688 |
self.draw_func = self.scroll_credits |
| 689 |
self.window = self.make_credits () |
| 690 |
self.window.py_signal_connect (self.on_draw, adonthell.win_event_UPDATE) |
| 691 |
adonthell.win_manager_get_active ().add (self.window) |
| 692 |
|
| 693 |
|
| 694 |
def update_wood (self, pic, x): |
| 695 |
if x >= adonthell.screen_length (): x = x - pic.length () |
| 696 |
else: x = x + 1 |
| 697 |
return x |
| 698 |
|
| 699 |
|
| 700 |
def draw_wood (self, pic, x): |
| 701 |
pic.draw (x, 0, self.da) |
| 702 |
if x > 0: |
| 703 |
pic.draw (x - pic.length (), 0, self.da) |
| 704 |
|
| 705 |
|
| 706 |
def make_credits (self): |
| 707 |
|
| 708 |
adonthell.audio_load_background (0, "audio/at-demo-8.ogg") |
| 709 |
adonthell.audio_play_background (0) |
| 710 |
|
| 711 |
|
| 712 |
self.window = adonthell.win_container () |
| 713 |
self.window.move (0, 30) |
| 714 |
self.window.resize (320, 180) |
| 715 |
self.window.set_visible_border (False) |
| 716 |
self.window.set_trans_background (True) |
| 717 |
self.window.set_activate (True) |
| 718 |
self.window.set_visible (True) |
| 719 |
|
| 720 |
|
| 721 |
self.labels = [] |
| 722 |
self.step = 0 |
| 723 |
self.index = 0 |
| 724 |
self.anim = 0 |
| 725 |
|
| 726 |
|
| 727 |
self.make_credit_label (190) |
| 728 |
|
| 729 |
self.window.py_signal_connect (self.on_draw, adonthell.win_event_UPDATE) |
| 730 |
|
| 731 |
return self.window |
| 732 |
|
| 733 |
|
| 734 |
def make_credit_label (self, ypos): |
| 735 |
if self.index > 0: |
| 736 |
ypos = ypos + (self.credits[self.index - 1][1] - 1) * 15 |
| 737 |
|
| 738 |
label = adonthell.win_label () |
| 739 |
label.resize (10, 0) |
| 740 |
label.set_font (adonthell.win_manager_get_font ("white")) |
| 741 |
label.set_align (adonthell.win_base_ALIGN_CENTER) |
| 742 |
label.set_form (adonthell.label_AUTO_SIZE) |
| 743 |
label.set_text (self.credits[self.index][0]) |
| 744 |
label.move (label.x (), ypos) |
| 745 |
label.set_visible (True) |
| 746 |
label.thisown = 0 |
| 747 |
label.pack () |
| 748 |
|
| 749 |
self.labels.append (label) |
| 750 |
self.window.add (label) |
| 751 |
|
| 752 |
self.index = self.index + 1 |
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
def scroll_credits (self): |
| 757 |
self.anim = self.anim + 1 |
| 758 |
if self.anim % 3 != 0: return |
| 759 |
|
| 760 |
|
| 761 |
if (adonthell.input_has_been_pushed (adonthell.SDLK_ESCAPE) or \ |
| 762 |
adonthell.input_has_been_pushed (adonthell.SDLK_SPACE)) and \ |
| 763 |
self.skipping == False: |
| 764 |
adonthell.audio_fade_out_background (2000) |
| 765 |
self.skipping = True |
| 766 |
|
| 767 |
|
| 768 |
if self.skipping and adonthell.audio_is_background_finished(): |
| 769 |
adonthell.gamedata_engine ().main_quit () |
| 770 |
return |
| 771 |
|
| 772 |
if self.step == 0: |
| 773 |
idx = 0 |
| 774 |
|
| 775 |
|
| 776 |
while idx < len (self.labels): |
| 777 |
label = self.labels[idx] |
| 778 |
label.move (label.x (), label.y () - 1) |
| 779 |
|
| 780 |
|
| 781 |
if label.y () + label.height () < -5: |
| 782 |
self.labels.remove (label) |
| 783 |
|
| 784 |
|
| 785 |
else: |
| 786 |
idx = idx + 1 |
| 787 |
|
| 788 |
|
| 789 |
if self.credits[self.index][1] == -1: |
| 790 |
if label.y () + label.height ()//2 == 90: |
| 791 |
self.labels.remove (label) |
| 792 |
self.delay = 0 |
| 793 |
self.step = 1 |
| 794 |
|
| 795 |
|
| 796 |
elif label.y () - 180 < 0: |
| 797 |
self.make_credit_label (label.y () + label.height ()) |
| 798 |
|
| 799 |
|
| 800 |
elif self.step == 1: |
| 801 |
self.delay = self.delay + 1 |
| 802 |
if self.delay == 70: |
| 803 |
self.make_credit_label (90) |
| 804 |
self.step = 2 |
| 805 |
|
| 806 |
|
| 807 |
elif self.step == 2: |
| 808 |
self.delay = self.delay + 1 |
| 809 |
if self.delay == 100: |
| 810 |
adonthell.gamedata_engine ().main_quit () |