Back to index

freedink-data  1.08.20080920
ITEM-FB.c
Go to the documentation of this file.
00001 //item fireball
00002 
00003 void use( void )
00004 {
00005 
00006 &mydir = sp_dir(1, -1);
00007 
00008 //disallow diagonal fireballs for now
00009 
00010 if (sp_dir(1, -1) == 1)
00011     sp_dir(1, 4);
00012 if (sp_dir(1, -1) == 3)
00013     sp_dir(1, 6);
00014 if (sp_dir(1, -1) == 7)
00015     sp_dir(1, 4);
00016 if (sp_dir(1, -1) == 9)
00017     sp_dir(1, 6);
00018 
00019 
00020 &basehit = sp_dir(1, -1);
00021 &basehit += 320;
00022 
00023 sp_seq(1, &basehit);
00024 sp_frame(1, 1); //reset seq to 1st frame
00025 sp_kill_wait(1); //make sure dink will punch right away
00026 sp_nocontrol(1, 1); //dink can't move until anim is done!
00027  &magic_level = 0;
00028  draw_status();
00029  &mholdx = sp_x(1, -1);
00030  &mholdy = sp_y(1, -1);
00031 //freeze(1);
00032 
00033  wait(100);
00034 
00035 if (&mydir == 1)
00036   {
00037   &mholdx -= 30;
00038   &junk = create_sprite(&mholdx, &mholdy, 11, 504, 1);
00039   sp_seq(&junk, 504); 
00040   sp_mx(&junk, -6);
00041   sp_my(&junk, +2);
00042 
00043   }
00044 
00045 
00046 
00047 
00048 if (&mydir == 4)
00049   {
00050   &mholdx -= 30;
00051   &junk = create_sprite(&mholdx, &mholdy, 11, 504, 1);
00052   sp_seq(&junk, 504); 
00053   sp_dir(&junk, 4);
00054   }
00055 
00056 if (&mydir == 6)
00057   {
00058 //  &mholdy -= 10; 
00059   &mholdx += 30;
00060   &junk = create_sprite(&mholdx, &mholdy, 11, 506, 1);
00061   sp_seq(&junk, 506); 
00062   sp_dir(&junk, 6);
00063   }
00064 
00065 if (&mydir == 3)
00066   {
00067   &mholdx += 30;
00068 
00069   &junk = create_sprite(&mholdx, &mholdy, 11, 506, 1);
00070   sp_seq(&junk, 506); 
00071   sp_mx(&junk, +6);
00072   sp_my(&junk, +2);
00073 
00074   }
00075 
00076 
00077 
00078 
00079 if (&mydir == 2)
00080   {
00081   &junk = create_sprite(&mholdx, &mholdy, 11, 502, 1);
00082   sp_seq(&junk, 502); 
00083   sp_dir(&junk, 2);
00084   }
00085 
00086 if (&mydir == 7)
00087   {
00088   &mholdx -= 30;
00089   &junk = create_sprite(&mholdx, &mholdy, 11, 504, 1);
00090   sp_seq(&junk, 504); 
00091   sp_mx(&junk, -6);
00092   sp_my(&junk, -2);
00093 
00094   }
00095 
00096 
00097 if (&mydir == 8)
00098   {
00099   &junk = create_sprite(&mholdx, &mholdy, 11, 508, 1);
00100   sp_seq(&junk, 508); 
00101   sp_dir(&junk, 8);
00102   }
00103 
00104 if (&mydir == 9)
00105   {
00106   &mholdx += 30;
00107   &junk = create_sprite(&mholdx, &mholdy, 11, 506, 1);
00108   sp_seq(&junk, 506); 
00109   sp_mx(&junk, +6);
00110   sp_my(&junk, -2);
00111 
00112   }
00113 
00114 
00115 
00116 //create fake shadow effect
00117 playsound(17, 8000,0,&junk,0);
00118 
00119   sp_timing(&junk, 0);
00120   sp_speed(&junk, 6);
00121   sp_strength(&junk, 10);
00122   sp_range(&junk, 10);
00123   //this makes it easier to hit stuff
00124   sp_flying(&junk, 1);
00125   sp_script(&junk, "dam-fire");
00126   //when the fireball hits something, it will look to this script, this way
00127   //we can burn trees when appropriate
00128   &mshadow = create_sprite(&mholdx, &mholdy, 15, 432, 3);
00129   sp_brain_parm(&mshadow, &junk);
00130   sp_que(&mshadow, -500);
00131   //will be drawn under everything
00132 
00133   //set fireball to not be able to damage Dink or the shadow
00134   sp_brain_parm(&junk, 1);
00135   sp_brain_parm2(&junk, &mshadow);
00136 
00137 unfreeze(1);
00138 }
00139 
00140 void disarm(void)
00141 {
00142 &magic_cost = 0;
00143 kill_this_task();
00144 }
00145 
00146 void arm(void)
00147 {
00148 Debug("Preloading fireball");
00149 
00150 int &basehit;
00151 int &mholdx;
00152 int &mholdy;
00153 int &junk;
00154 int &mshadow;
00155 int &mydir;
00156 &magic_cost = 100;
00157 preload_seq(322);
00158 preload_seq(324);
00159 preload_seq(326);
00160 preload_seq(328);
00161 preload_seq(502);
00162 preload_seq(504);
00163 preload_seq(506);
00164 preload_seq(508);
00165 
00166 //tree burn
00167 preload_seq(20);
00168 
00169 //explosion
00170 preload_seq(70);
00171 }
00172 
00173 void pickup(void)
00174 {
00175 Debug("Player now owns this item.");
00176 kill_this_task();
00177 }
00178 
00179 void drop(void)
00180 {
00181 Debug("Item dropped.");
00182 kill_this_task();
00183 }
00184 
00185