SPECEFFE.CPP
上传用户:junwei_58
上传日期:2007-05-15
资源大小:79k
文件大小:2k
源码类别:

其他智力游戏

开发平台:

Visual C++

  1. #define SPECEFFECT_CPP
  2. #include <dos.h>
  3. #include <stdlib.h>
  4. #include "game.h"
  5. #include "bubble.h"
  6. #include "speceffe.h"
  7. void ready_GO(){
  8. //message("Ready");
  9. for(int j=0;j<5;j++){
  10. if(soundON)sound((31+j)*20);
  11. delay(100);
  12. }
  13. //message("Ready",1);
  14. nosound();
  15. //message("GO");
  16. delay(100);
  17. //message("GO",1);
  18. }
  19. void beep(){
  20. if(soundON){
  21. sound(500);delay(20);sound(440);delay(10);
  22. sound(320);delay(10);nosound();
  23. }
  24. }
  25. void smoothout(){
  26. SvgaDAC pal[256],tpal[256];
  27. getpalette(0,256,pal);
  28. for(int i=60;i;i--){
  29. delay(10);
  30. for(int j=0;j<256;j++){
  31. tpal[j].red=i*pal[j].red/60;
  32. tpal[j].green=i*pal[j].green/60;
  33. tpal[j].blue=i*pal[j].blue/60;
  34. }
  35. setpalette(0,256,tpal);
  36. }
  37. clrScr(BKGROUNDCOLOR);
  38. setpalette(0,256,pal);//*/
  39. }
  40. void setPalette(){
  41.  int c,p=159,per=54;
  42.  SvgaDAC pal[256];
  43.  getpalette(0,256,pal);
  44.  pal[1].red=0; pal[1].green=0; pal[1].blue=255;
  45.  pal[4].red=150; pal[4].green=0; pal[4].blue=0;
  46.  pal[10].red=0; pal[10].green=255; pal[10].blue=0;
  47.  pal[13].red=255; pal[13].green=100; pal[13].blue=50;
  48.  pal[14].red=255; pal[14].green=255; pal[14].blue=0;
  49.  pal[15].red=255; pal[15].green=255; pal[15].blue=255;
  50.  for(c=159;c>9;c--){
  51.  pal[p].red=per*pal[c/10].red/100;
  52.  pal[p].green=per*pal[c/10].green/100;
  53.  pal[p].blue=per*pal[c/10].blue/100;
  54.  p--;
  55.  per+=5;
  56.  if(per>100)per=54;
  57.  }
  58.  pal[0].red=90;pal[0].green=100;pal[0].blue=100;//BKGROUNDCOLOR
  59.  pal[1].red=0; pal[1].green=0;  pal[1].blue=0;  //ARROWCOLOR
  60.  pal[2].red=10;pal[2].green=50; pal[2].blue=60; //BORDERCOLOR
  61.  pal[3].red=50;pal[3].green=50; pal[3].blue=80;  //TEXTCOLOR
  62.  pal[4].red=250;pal[4].green=150;pal[4].blue=150;  //TEXTCOLOR2
  63.  setpalette(0,256,pal);
  64. }
  65. void PixelDance(){ // does a pixel dance! actually, randomly places a colored
  66. int r1, r2;  // pixel here and there for a funky looking interface
  67. uchar c;
  68. for (int a = 0; a <= 50; a++ ){
  69. r1 = rand() % 800;
  70. r2 = rand() % 600;
  71. c=getpixel(r1, r2);
  72. if(c>=10&&c<160){
  73. c-=c%10;
  74. c+=rand()%10;
  75. setpixel( r1, r2, c  );
  76. }
  77. }
  78. }