Mercurial > hg > demos > krapula
comparison krapula.c @ 40:9cbb03e85597
Update to latest dmlib API changes.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 13 Apr 2013 02:16:31 +0300 |
parents | 57d67886153e |
children | c32b6fc0951b |
comparison
equal
deleted
inserted
replaced
39:57d67886153e | 40:9cbb03e85597 |
---|---|
326 | 326 |
327 SDL_Surface *bmap; | 327 SDL_Surface *bmap; |
328 SDL_Surface *nosfe[NOSFE_MAX - NOSFE_MIN + 1]; | 328 SDL_Surface *nosfe[NOSFE_MAX - NOSFE_MIN + 1]; |
329 | 329 |
330 | 330 |
331 int demoPreInit() | 331 int demoPreInit(DMEngineData *engine) |
332 { | 332 { |
333 dmInitProg("krapula", | 333 dmInitProg("krapula", |
334 "Lauantai Aamun Krapula", | 334 "Lauantai Aamun Krapula", |
335 "0.2", "(c) 2012 Anciat Prodz & TNSP", "PENIS."); | 335 "0.2", "(c) 2012 Anciat Prodz & TNSP", "PENIS."); |
336 | 336 |
337 engine.optPackFilename = "orvellys.dat"; | 337 engine->optPackFilename = "orvellys.dat"; |
338 engine.optDataPath = NULL; | 338 engine->optDataPath = NULL; |
339 engine.optResFlags = DRF_USE_PACK | DRF_PRELOAD_RES; | 339 engine->optResFlags = DRF_USE_PACK | DRF_PRELOAD_RES; |
340 | 340 |
341 engine.optScrWidth = 640; | 341 engine->optVidSetup = DM_VSETUP_ASPECT; |
342 engine.optScrHeight = 480; | 342 engine->optVidWidth = 640; |
343 engine.optBitDepth = 32; | 343 engine->optVidHeight = 480; |
344 engine.optVFlags = SDL_SWSURFACE | SDL_HWPALETTE; | 344 engine->optVidDepth = 32; |
345 | 345 engine->optVFlags = SDL_SWSURFACE; |
346 | 346 |
347 engine.demoInit = demoInit; | 347 |
348 engine.demoRender = demoRender; | 348 engine->demoInit = demoInit; |
349 engine.demoShutdown = demoShutdown; | 349 engine->demoRender = demoRender; |
350 engine.demoQuit = demoQuit; | 350 engine->demoShutdown = demoShutdown; |
351 engine->demoQuit = demoQuit; | |
351 | 352 |
352 return DMERR_OK; | 353 return DMERR_OK; |
353 } | 354 } |
354 | 355 |
355 | 356 |
356 static int demoInit() | 357 static int demoInit(DMEngineData *engine) |
357 { | 358 { |
358 int i; | 359 int i; |
359 | 360 |
360 // Initialize effect stuff | 361 // Initialize effect stuff |
361 dmPerlinInit(); | 362 dmPerlinInit(); |
362 | 363 |
363 for (i = 0; i < NOSFE_MAX; i++) | 364 for (i = 0; i < NOSFE_MAX; i++) |
364 { | 365 { |
365 char fname[32]; | 366 char fname[32]; |
366 snprintf(fname, sizeof(fname), "%08d.jpg", NOSFE_MIN + i); | 367 snprintf(fname, sizeof(fname), "%08d.jpg", NOSFE_MIN + i); |
367 engineGetResImage(nosfe[i], fname); | 368 engineGetResImage(engine, nosfe[i], fname); |
368 } | 369 } |
369 | 370 |
370 for (i = 0; i < ncredits; i++) | 371 for (i = 0; i < ncredits; i++) |
371 engineGetResImage(credits[i].img, credits[i].filename); | 372 engineGetResImage(engine, credits[i].img, credits[i].filename); |
372 | 373 |
373 bmap = SDL_CreateRGBSurface(SDL_SWSURFACE, QWIDTH, QHEIGHT, 8, 0, 0, 0, 0); | 374 bmap = SDL_CreateRGBSurface(SDL_SWSURFACE, QWIDTH, QHEIGHT, 8, 0, 0, 0, 0); |
374 | 375 |
375 | 376 |
376 // Initialize music player | 377 // Initialize music player |
377 JSSModule *mod = NULL; | 378 JSSModule *mod = NULL; |
378 engineGetResModule(mod, "krapula.xm"); | 379 engineGetResModule(engine, mod, "krapula.xm"); |
379 | 380 |
380 if ((i = jssConvertModuleForPlaying(mod)) != DMERR_OK) | 381 if ((i = jssConvertModuleForPlaying(mod)) != DMERR_OK) |
381 { | 382 { |
382 dmError("Could not convert module for playing, %d: %s\n", | 383 dmError("Could not convert module for playing, %d: %s\n", |
383 i, dmErrorStr(i)); | 384 i, dmErrorStr(i)); |
384 return DMERR_INIT_FAIL; | 385 return DMERR_INIT_FAIL; |
385 } | 386 } |
386 | 387 |
387 jvmSetCallback(engine.dev, jmpExec, engine.plr); | 388 jvmSetCallback(engine->dev, jmpExec, engine->plr); |
388 jmpSetModule(engine.plr, mod); | 389 jmpSetModule(engine->plr, mod); |
389 jmpPlayOrder(engine.plr, 0); | 390 jmpPlayOrder(engine->plr, 0); |
390 jvmSetGlobalVol(engine.dev, 55); | 391 jvmSetGlobalVol(engine->dev, 55); |
391 | 392 |
392 return DMERR_OK; | 393 return DMERR_OK; |
393 } | 394 } |
394 | 395 |
395 | 396 |
396 static void demoShutdown() | 397 static void demoShutdown(DMEngineData *engine) |
397 { | 398 { |
399 (void) engine; | |
398 SDL_FreeSurface(bmap); | 400 SDL_FreeSurface(bmap); |
399 } | 401 } |
400 | 402 |
401 | 403 |
402 static void demoQuit() | 404 static void demoQuit() |
403 { | 405 { |
404 dmPrint(0, "Krapulassa on kivaa.\n"); | 406 dmPrint(0, "Krapulassa on kivaa.\n"); |
405 } | 407 } |
406 | 408 |
407 | 409 |
408 static int demoRender() | 410 static int demoRender(DMEngineData *engine) |
409 { | 411 { |
410 float t = engineGetTimeDT(); | 412 float t = engineGetTimeDT(engine); |
411 | 413 |
412 if (t < 5) | 414 if (t < 5) |
413 { | 415 { |
414 int dt = engineGetTime(0); | 416 int dt = engineGetTime(engine, 0); |
415 static SDL_Surface *anciat; | 417 static SDL_Surface *anciat; |
416 static DMLerpContext lerpX, lerpY, lerpD; | 418 static DMLerpContext lerpX, lerpY, lerpD; |
417 static DMScaledBlitFunc nblit; | 419 static DMScaledBlitFunc nblit; |
418 DMVector light; | 420 DMVector light; |
419 static BOOL nollattu = FALSE; | 421 static BOOL nollattu = FALSE; |
420 if (!nollattu) | 422 if (!nollattu) |
421 { | 423 { |
422 engineGetResImage(anciat, "anciat.png"); | 424 engineGetResImage(engine, anciat, "anciat.png"); |
423 nblit = dmGetScaledBlitFunc(bmap->format, engine.screen->format, DMD_NONE); | 425 nblit = dmGetScaledBlitFunc(bmap->format, engine->screen->format, DMD_NONE); |
424 dmMakePalette(bmap); | 426 dmMakePalette(bmap); |
425 dmLerpInit(&lerpX, 0, QWIDTH, 5000); | 427 dmLerpInit(&lerpX, 0, QWIDTH, 5000); |
426 dmLerpInit(&lerpY, QHEIGHT * 0.25, QHEIGHT * 0.75, 5000); | 428 dmLerpInit(&lerpY, QHEIGHT * 0.25, QHEIGHT * 0.75, 5000); |
427 dmLerpInit(&lerpD, 0.04, 0.08, 5000); | 429 dmLerpInit(&lerpD, 0.04, 0.08, 5000); |
428 nollattu = TRUE; | 430 nollattu = TRUE; |
431 light.x = dmLerpSCurve(&lerpX, dt); | 433 light.x = dmLerpSCurve(&lerpX, dt); |
432 light.y = dmLerp1(&lerpY, dt); | 434 light.y = dmLerp1(&lerpY, dt); |
433 light.z = 128; | 435 light.z = 128; |
434 | 436 |
435 dmShadowTraceHeightMap2(bmap->pixels, anciat->pixels, &light); | 437 dmShadowTraceHeightMap2(bmap->pixels, anciat->pixels, &light); |
436 nblit(bmap, 0, 0, engine.screen->w, engine.screen->h, engine.screen); | 438 nblit(bmap, 0, 0, engine->screen->w, engine->screen->h, engine->screen); |
437 } | 439 } |
438 else | 440 else |
439 if (t < 10) | 441 if (t < 10) |
440 { | 442 { |
441 int dt = engineGetTime(5); | 443 int dt = engineGetTime(engine, 5); |
442 static SDL_Surface *logobg, *logolayer1, *logolayer2; | 444 static SDL_Surface *logobg, *logolayer1, *logolayer2; |
443 static DMScaledBlitFunc nblit, kblit; | 445 static DMScaledBlitFunc nblit, kblit; |
444 static DMLerpContext lerpD; | 446 static DMLerpContext lerpD; |
445 static BOOL nollattu = FALSE; | 447 static BOOL nollattu = FALSE; |
446 | 448 |
447 if (!nollattu) | 449 if (!nollattu) |
448 { | 450 { |
449 engineGetResImage(logobg, "logobg.png"); | 451 engineGetResImage(engine, logobg, "logobg.png"); |
450 engineGetResImage(logolayer1, "logolayer1.png"); | 452 engineGetResImage(engine, logolayer1, "logolayer1.png"); |
451 engineGetResImage(logolayer2, "logolayer2.png"); | 453 engineGetResImage(engine, logolayer2, "logolayer2.png"); |
452 | 454 |
453 nblit = dmGetScaledBlitFunc(logobg->format, engine.screen->format, DMD_TRANSPARENT); | 455 nblit = dmGetScaledBlitFunc(logobg->format, engine->screen->format, DMD_TRANSPARENT); |
454 kblit = dmGetScaledBlitFunc(logobg->format, engine.screen->format, DMD_NONE); | 456 kblit = dmGetScaledBlitFunc(logobg->format, engine->screen->format, DMD_NONE); |
455 dmLerpInit(&lerpD, 0.01, 500, 10000); | 457 dmLerpInit(&lerpD, 0.01, 500, 10000); |
456 nollattu = TRUE; | 458 nollattu = TRUE; |
457 } | 459 } |
458 | 460 |
459 float q = dmLerpSCurve(&lerpD, dt); | 461 float q = dmLerpSCurve(&lerpD, dt); |
463 | 465 |
464 float t2 = sin((float) dt / 150.0f + 0.2f); | 466 float t2 = sin((float) dt / 150.0f + 0.2f); |
465 int x2 = t2 * 25.0f + q, y2 = t * 35.0f + q*2.0f, | 467 int x2 = t2 * 25.0f + q, y2 = t * 35.0f + q*2.0f, |
466 w2 = t2 * 70.0f + q, h2 = t * 40.0f + q*2.0f; | 468 w2 = t2 * 70.0f + q, h2 = t * 40.0f + q*2.0f; |
467 | 469 |
468 kblit(logobg, 0, 0, engine.screen->w, engine.screen->h, engine.screen); | 470 kblit(logobg, 0, 0, engine->screen->w, engine->screen->h, engine->screen); |
469 nblit(logolayer1, -x, -y, engine.screen->w+w, engine.screen->h+h, engine.screen); | 471 nblit(logolayer1, -x, -y, engine->screen->w+w, engine->screen->h+h, engine->screen); |
470 nblit(logolayer2, -x2, -y2, engine.screen->w+w2, engine.screen->h+h2, engine.screen); | 472 nblit(logolayer2, -x2, -y2, engine->screen->w+w2, engine->screen->h+h2, engine->screen); |
471 } | 473 } |
472 else | 474 else |
473 if (t < 20) | 475 if (t < 20) |
474 { | 476 { |
475 int dt = engineGetTime(10); | 477 int dt = engineGetTime(engine, 10); |
476 static SDL_Surface *gay, *logobg; | 478 static SDL_Surface *gay, *logobg; |
477 static DMLerpContext lerpX, lerpY, lerpD; | 479 static DMLerpContext lerpX, lerpY, lerpD; |
478 static DMScaledBlitFunc nblit, kblit; | 480 static DMScaledBlitFunc nblit, kblit; |
479 static BOOL nollattu = FALSE; | 481 static BOOL nollattu = FALSE; |
480 DMVector light; | 482 DMVector light; |
481 DMBlockMap heightMap; | 483 DMBlockMap heightMap; |
482 | 484 |
483 if (!nollattu) | 485 if (!nollattu) |
484 { | 486 { |
485 engineGetResImage(gay, "gay.png"); | 487 engineGetResImage(engine, gay, "gay.png"); |
486 engineGetResImage(logobg, "logobg.png"); | 488 engineGetResImage(engine, logobg, "logobg.png"); |
487 nblit = dmGetScaledBlitFunc(bmap->format, engine.screen->format, DMD_NONE); | 489 nblit = dmGetScaledBlitFunc(bmap->format, engine->screen->format, DMD_NONE); |
488 kblit = dmGetScaledBlitFunc(logobg->format, engine.screen->format, DMD_TRANSPARENT); | 490 kblit = dmGetScaledBlitFunc(logobg->format, engine->screen->format, DMD_TRANSPARENT); |
489 dmMakePalette(bmap); | 491 dmMakePalette(bmap); |
490 dmLerpInit(&lerpX, QWIDTH, 0, 10000); | 492 dmLerpInit(&lerpX, QWIDTH, 0, 10000); |
491 dmLerpInit(&lerpY, QHEIGHT * 0.25, QHEIGHT * 0.75, 10000); | 493 dmLerpInit(&lerpY, QHEIGHT * 0.25, QHEIGHT * 0.75, 10000); |
492 dmLerpInit(&lerpD, 0.04, 0.08, 10000); | 494 dmLerpInit(&lerpD, 0.04, 0.08, 10000); |
493 nollattu = TRUE; | 495 nollattu = TRUE; |
499 | 501 |
500 dmMakeBumpMap(heightMap, dmLerpSCurve(&lerpD, dt), 254); | 502 dmMakeBumpMap(heightMap, dmLerpSCurve(&lerpD, dt), 254); |
501 | 503 |
502 dmShadowTraceHeightMap(bmap->pixels, heightMap, &light); | 504 dmShadowTraceHeightMap(bmap->pixels, heightMap, &light); |
503 | 505 |
504 nblit(bmap, 0, 0, engine.screen->w, engine.screen->h, engine.screen); | 506 nblit(bmap, 0, 0, engine->screen->w, engine->screen->h, engine->screen); |
505 | 507 |
506 if ((dt / 100) % 10 < 5) | 508 if ((dt / 100) % 10 < 5) |
507 { | 509 { |
508 kblit(gay, 0, 0, engine.screen->w, engine.screen->h, engine.screen); | 510 kblit(gay, 0, 0, engine->screen->w, engine->screen->h, engine->screen); |
509 } | 511 } |
510 } | 512 } |
511 else | 513 else |
512 if (t < 45) | 514 if (t < 45) |
513 { | 515 { |
514 static SDL_Surface *ruutu; | 516 static SDL_Surface *ruutu; |
515 static int currState, currCredit, creditStartTime; | 517 static int currState, currCredit, creditStartTime; |
516 static DMLerpContext lerpX, lerpY, lerpZ; | 518 static DMLerpContext lerpX, lerpY, lerpZ; |
517 static DMScaledBlitFunc nblit, kblit; | 519 static DMScaledBlitFunc nblit, kblit; |
518 static BOOL stateChange, nollattu = FALSE; | 520 static BOOL stateChange, nollattu = FALSE; |
519 int currFrame = engineGetTime(20) * 15 / 1000; | 521 int currFrame = engineGetTime(engine, 20) * 15 / 1000; |
520 if (!nollattu) | 522 if (!nollattu) |
521 { | 523 { |
522 engineGetResImage(ruutu, "ruutu.png"); | 524 engineGetResImage(engine, ruutu, "ruutu.png"); |
523 dmClearSurface(ruutu, dmMapRGBA(ruutu, 0,0,0,0)); | 525 dmClearSurface(ruutu, dmMapRGBA(ruutu, 0,0,0,0)); |
524 nblit = dmGetScaledBlitFunc(nosfe[0]->format, engine.screen->format, DMD_NONE); | 526 nblit = dmGetScaledBlitFunc(nosfe[0]->format, engine->screen->format, DMD_NONE); |
525 kblit = dmGetScaledBlitFunc(credits[0].img->format, engine.screen->format, DMD_TRANSPARENT); | 527 kblit = dmGetScaledBlitFunc(credits[0].img->format, engine->screen->format, DMD_TRANSPARENT); |
526 currCredit = -1; | 528 currCredit = -1; |
527 currState = -1; | 529 currState = -1; |
528 stateChange = TRUE; | 530 stateChange = TRUE; |
529 nollattu = TRUE; | 531 nollattu = TRUE; |
530 } | 532 } |
531 | 533 |
532 float gt = 1.0f + sin(engineGetTime(0) / 250.0f); | 534 float gt = 1.0f + sin(engineGetTime(engine, 0) / 250.0f); |
533 int g1 = gt * 25.0f, g2 = gt * 50.0f; | 535 int g1 = gt * 25.0f, g2 = gt * 50.0f; |
534 | 536 |
535 nblit(nosfe[currFrame % NOSFE_MAX], -g1, -g1, engine.screen->w+g2, engine.screen->h+g2, engine.screen); | 537 nblit(nosfe[currFrame % NOSFE_MAX], -g1, -g1, engine->screen->w+g2, engine->screen->h+g2, engine->screen); |
536 | 538 |
537 if (t >= 30) | 539 if (t >= 30) |
538 { | 540 { |
539 int qtime = engineGetTime(30); | 541 int qtime = engineGetTime(engine, 30); |
540 int creditTime = (engineGetTime(0) - creditStartTime); | 542 int creditTime = engineGetTime(engine, 0) - creditStartTime; |
541 float zscale; | 543 float zscale; |
542 if ( ( (qtime / (CREDITS_SPEED + 500)) % 2) == 0 && currState == -1) | 544 if ( ( (qtime / (CREDITS_SPEED + 500)) % 2) == 0 && currState == -1) |
543 stateChange = TRUE; | 545 stateChange = TRUE; |
544 | 546 |
545 if (stateChange && currCredit < ncredits) | 547 if (stateChange && currCredit < ncredits) |
548 switch (currState) | 550 switch (currState) |
549 { | 551 { |
550 case 0: | 552 case 0: |
551 { | 553 { |
552 int qt = (qtime / 100) % nrandomCoords; | 554 int qt = (qtime / 100) % nrandomCoords; |
553 creditStartTime = engineGetTime(0); | 555 creditStartTime = engineGetTime(engine, 0); |
554 creditTime = 0; | 556 creditTime = 0; |
555 dmLerpInit(&lerpX, randomCoords[qt].x, credits[currCredit].x - 50, CREDITS_SPEED); | 557 dmLerpInit(&lerpX, randomCoords[qt].x, credits[currCredit].x - 50, CREDITS_SPEED); |
556 dmLerpInit(&lerpY, randomCoords[qt].y, credits[currCredit].y - 50, CREDITS_SPEED); | 558 dmLerpInit(&lerpY, randomCoords[qt].y, credits[currCredit].y - 50, CREDITS_SPEED); |
557 dmLerpInit(&lerpZ, 5.0f, 0.0f, CREDITS_SPEED); | 559 dmLerpInit(&lerpZ, 5.0f, 0.0f, CREDITS_SPEED); |
558 currState = 1; | 560 currState = 1; |
584 } | 586 } |
585 | 587 |
586 | 588 |
587 if (currCredit > 0) | 589 if (currCredit > 0) |
588 { | 590 { |
589 kblit(ruutu, 0, 0, engine.screen->w, engine.screen->h, engine.screen); | 591 kblit(ruutu, 0, 0, engine->screen->w, engine->screen->h, engine->screen); |
590 } | 592 } |
591 | 593 |
592 if (currState == 1) | 594 if (currState == 1) |
593 { | 595 { |
594 if (creditTime >= CREDITS_SPEED) | 596 if (creditTime >= CREDITS_SPEED) |
602 kblit(credits[currCredit].img, | 604 kblit(credits[currCredit].img, |
603 dmLerpSCurve(&lerpX, creditTime) - (zscale * credits[currCredit].img->w), | 605 dmLerpSCurve(&lerpX, creditTime) - (zscale * credits[currCredit].img->w), |
604 dmLerpSCurve(&lerpY, creditTime) - (zscale * credits[currCredit].img->h), | 606 dmLerpSCurve(&lerpY, creditTime) - (zscale * credits[currCredit].img->h), |
605 credits[currCredit].img->w * (1.0f + zscale), | 607 credits[currCredit].img->w * (1.0f + zscale), |
606 credits[currCredit].img->h * (1.0f + zscale), | 608 credits[currCredit].img->h * (1.0f + zscale), |
607 engine.screen); | 609 engine->screen); |
608 } | 610 } |
609 } | 611 } |
610 | 612 |
611 } | 613 } |
612 else | 614 else |
613 if (t < 60) | 615 if (t < 60) |
614 { | 616 { |
615 int dt = engineGetTime(45); | 617 int dt = engineGetTime(engine, 45); |
616 static SDL_Surface *logobg, *greets; | 618 static SDL_Surface *logobg, *greets; |
617 static DMScaledBlitFunc nblit, kblit; | 619 static DMScaledBlitFunc nblit, kblit; |
618 static DMLerpContext lerpD; | 620 static DMLerpContext lerpD; |
619 static BOOL nollattu = FALSE; | 621 static BOOL nollattu = FALSE; |
620 | 622 |
621 if (!nollattu) | 623 if (!nollattu) |
622 { | 624 { |
623 engineGetResImage(logobg, "logobg.png"); | 625 engineGetResImage(engine, logobg, "logobg.png"); |
624 engineGetResImage(greets, "greetings.png"); | 626 engineGetResImage(engine, greets, "greetings.png"); |
625 nblit = dmGetScaledBlitFunc(logobg->format, engine.screen->format, DMD_TRANSPARENT); | 627 nblit = dmGetScaledBlitFunc(logobg->format, engine->screen->format, DMD_TRANSPARENT); |
626 kblit = dmGetScaledBlitFunc(logobg->format, engine.screen->format, DMD_NONE); | 628 kblit = dmGetScaledBlitFunc(logobg->format, engine->screen->format, DMD_NONE); |
627 dmLerpInit(&lerpD, 0.01, 500, 10000); | 629 dmLerpInit(&lerpD, 0.01, 500, 10000); |
628 nollattu = TRUE; | 630 nollattu = TRUE; |
629 } | 631 } |
630 | 632 |
631 float q = dmLerpSCurve(&lerpD, dt); | 633 float q = dmLerpSCurve(&lerpD, dt); |
632 float t = sin((float) dt / 150.0f), | 634 float t = sin((float) dt / 150.0f), |
633 j = (1.0 + t) * 15; | 635 j = (1.0 + t) * 15; |
634 int x = t * 25.0f + q, y = t * 35.0f + q, | 636 int x = t * 25.0f + q, y = t * 35.0f + q, |
635 w = t * 70.0f + q*2.0f, h = t * 40.0f + q*2.0f; | 637 w = t * 70.0f + q*2.0f, h = t * 40.0f + q*2.0f; |
636 | 638 |
637 kblit(logobg, -j, -j, engine.screen->w+j*2.0f, engine.screen->h+j*2.0f, engine.screen); | 639 kblit(logobg, -j, -j, engine->screen->w+j*2.0f, engine->screen->h+j*2.0f, engine->screen); |
638 nblit(greets, -x, -y, engine.screen->w+w, engine.screen->h+h, engine.screen); | 640 nblit(greets, -x, -y, engine->screen->w+w, engine->screen->h+h, engine->screen); |
639 } | 641 } |
640 else | 642 else |
641 engine.exitFlag = TRUE; | 643 engine->exitFlag = TRUE; |
642 | 644 |
643 | 645 |
644 { | 646 { |
645 static SDL_Surface *feidi; | 647 static SDL_Surface *feidi; |
646 static int fadeStartTime; | 648 static int fadeStartTime; |
649 BOOL hit; | 651 BOOL hit; |
650 int ch; | 652 int ch; |
651 | 653 |
652 if (!nollattu) | 654 if (!nollattu) |
653 { | 655 { |
654 engineGetResImage(feidi, "feidi.png"); | 656 engineGetResImage(engine, feidi, "feidi.png"); |
655 dmLerpInit(&fadeLerp, 255, 0, 250); | 657 dmLerpInit(&fadeLerp, 255, 0, 250); |
656 nollattu = TRUE; | 658 nollattu = TRUE; |
657 } | 659 } |
658 | 660 |
659 JSS_LOCK(engine.plr); | 661 JSS_LOCK(engine->plr); |
660 for (hit = FALSE, ch = 0; ch < 6; ch++) | 662 for (hit = FALSE, ch = 0; ch < 6; ch++) |
661 if (engine.plr->channels[ch].nextInstrument == 0) | 663 if (engine->plr->channels[ch].nextInstrument == 0) |
662 { | 664 { |
663 hit = TRUE; | 665 hit = TRUE; |
664 break; | 666 break; |
665 } | 667 } |
666 JSS_UNLOCK(engine.plr); | 668 JSS_UNLOCK(engine->plr); |
667 | 669 |
668 if (hit && !fadeActive) | 670 if (hit && !fadeActive) |
669 { | 671 { |
670 fadeActive = TRUE; | 672 fadeActive = TRUE; |
671 fadeStartTime = engineGetTime(0); | 673 fadeStartTime = engineGetTime(engine, 0); |
672 } | 674 } |
673 if (fadeActive) | 675 if (fadeActive) |
674 { | 676 { |
675 int fadeTime = engineGetTime(0) - fadeStartTime; | 677 int fadeTime = engineGetTime(engine, 0) - fadeStartTime; |
676 if (fadeTime < 250) | 678 if (fadeTime < 250) |
677 { | 679 { |
678 dmScaledBlitSurface32to32TransparentGA(feidi, | 680 dmScaledBlitSurface32to32TransparentGA(feidi, |
679 0, 0, engine.screen->w, engine.screen->h, engine.screen, | 681 0, 0, engine->screen->w, engine->screen->h, engine->screen, |
680 dmLerpSCurve(&fadeLerp, fadeTime)); | 682 dmLerpSCurve(&fadeLerp, fadeTime)); |
681 } | 683 } |
682 else | 684 else |
683 fadeActive = FALSE; | 685 fadeActive = FALSE; |
684 } | 686 } |