Back to index

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