Back to index

freedink-data  1.08.20080920
ITEM-SFB.c
Go to the documentation of this file.
00001 //item fireball
00002 
00003 void use( void )
00004 {
00005 //disallow diagonal fireballs for now
00006 
00007 if (sp_dir(1, -1) == 1)
00008     sp_dir(1, 2);
00009 if (sp_dir(1, -1) == 3)
00010     sp_dir(1, 2);
00011 if (sp_dir(1, -1) == 7)
00012     sp_dir(1, 8);
00013 if (sp_dir(1, -1) == 9)
00014     sp_dir(1, 8);
00015 
00016 &basehit = sp_dir(1, -1);
00017 &basehit += 320;
00018 
00019 sp_seq(1, &basehit);
00020 sp_frame(1, 1); //reset seq to 1st frame
00021 sp_kill_wait(1); //make sure dink will punch right away
00022 sp_nocontrol(1, 1); //dink can't move until anim is done!
00023 
00024  &mholdx = sp_x(1, -1);
00025  &mholdy = sp_y(1, -1);
00026  wait(40);
00027  &magic_level = 0;
00028  draw_status();
00029 if (sp_dir(1, -1) == 4)
00030   {
00031   &mholdx -= 30;
00032   &junk = create_sprite(&mholdx, &mholdy, 11, 514, 1);
00033   sp_seq(&junk, 514); 
00034   sp_dir(&junk, 4);
00035   }
00036 
00037 if (sp_dir(1, -1) == 6)
00038   {
00039 //  &mholdy -= 10; 
00040   &mholdx += 30;
00041   &junk = create_sprite(&mholdx, &mholdy, 11, 516, 1);
00042   sp_seq(&junk, 516); 
00043   sp_dir(&junk, 6);
00044   }
00045 
00046 if (sp_dir(1, -1) == 2)
00047   {
00048   &junk = create_sprite(&mholdx, &mholdy, 11, 512, 1);
00049   sp_seq(&junk, 512); 
00050   sp_dir(&junk, 2);
00051   }
00052 
00053 if (sp_dir(1, -1) == 8)
00054   {
00055   &junk = create_sprite(&mholdx, &mholdy, 11, 518, 1);
00056   sp_seq(&junk, 518); 
00057   sp_dir(&junk, 8);
00058   }
00059 
00060 //create fake shadow effect
00061 playsound(17, 8000,0,&junk,0);
00062 
00063   sp_timing(&junk, 0);
00064   sp_speed(&junk, 6);
00065   sp_strength(&junk, 40);
00066   sp_flying(&junk, 1);
00067   sp_range(&junk, 20);
00068   //this makes it easier to hit stuff
00069   sp_script(&junk, "dam-sfb");
00070   //when the fireball hits something, it will look to this script, this way
00071   //we can burn trees when appropriate
00072   &mshadow = create_sprite(&mholdx, &mholdy, 15, 432, 3);
00073   sp_brain_parm(&mshadow, &junk);
00074   sp_que(&mshadow, -500);
00075   sp_nohit(&mshadow, 1);
00076   //will be drawn under everything
00077   //set fireball to not be able to damage Dink or the shadow
00078   sp_brain_parm(&junk, 1);
00079   sp_brain_parm2(&junk, &mshadow);
00080 }
00081 
00082 void disarm(void)
00083 {
00084 &magic_cost = 0;
00085 kill_this_task();
00086 }
00087 
00088 void arm(void)
00089 {
00090 Debug("Preloading fireball");
00091 &magic_cost = 2000;
00092 int &basehit;
00093 int &mholdx;
00094 int &mholdy;
00095 int &junk;
00096 int &mshadow;
00097 preload_seq(322);
00098 preload_seq(324);
00099 preload_seq(326);
00100 preload_seq(328);
00101 
00102 preload_seq(512);
00103 preload_seq(514);
00104 preload_seq(516);
00105 preload_seq(518);
00106 //tree burn
00107 preload_seq(20);
00108 //explosion
00109 preload_seq(167);
00110 
00111 }
00112 
00113 void pickup(void)
00114 {
00115 Debug("Player now owns this item.");
00116 kill_this_task();
00117 }
00118 
00119 void drop(void)
00120 {
00121 Debug("Item dropped.");
00122 kill_this_task();
00123 }
00124 
00125