Back to index

freedink-data  1.08.20080920
ITEM-AXE.c
Go to the documentation of this file.
00001 //item axe
00002 
00003 void use( void )
00004 {
00005   int &stm;
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 playsound(8, 8000,0,0,0);
00018 
00019 &basehit = sp_dir(1, -1);
00020 &basehit += 320;
00021 
00022 sp_seq(1, &basehit);
00023 sp_frame(1, 1); //reset seq to 1st frame
00024 sp_kill_wait(1); //make sure dink will punch right away
00025 sp_nocontrol(1, 1); //dink can't move until anim is done!
00026  &mholdx = sp_x(1, -1);
00027  &mholdy = sp_y(1, -1);
00028 //freeze(1);
00029 
00030  wait(100);
00031 
00032 if (&mydir == 1)
00033   {
00034   &mholdx -= 30;
00035   &junk = create_sprite(&mholdx, &mholdy, 11, 85, 1);
00036   sp_seq(&junk, 85); 
00037   sp_mx(&junk, -6);
00038   sp_my(&junk, +2);
00039 
00040   }
00041 
00042 
00043 
00044 
00045 if (&mydir == 4)
00046   {
00047   &mholdx -= 30;
00048   &junk = create_sprite(&mholdx, &mholdy, 11, 85, 1);
00049   sp_seq(&junk, 85); 
00050   sp_dir(&junk, 4);
00051   }
00052 
00053 if (&mydir == 6)
00054   {
00055 //  &mholdy -= 10; 
00056   &mholdx += 30;
00057   &junk = create_sprite(&mholdx, &mholdy, 11, 85, 1);
00058   sp_seq(&junk, 85); 
00059   sp_dir(&junk, 6);
00060   }
00061 
00062 if (&mydir == 3)
00063   {
00064   &mholdx += 30;
00065 
00066   &junk = create_sprite(&mholdx, &mholdy, 11, 85, 1);
00067   sp_seq(&junk, 85); 
00068   sp_mx(&junk, +6);
00069   sp_my(&junk, +2);
00070 
00071   }
00072 
00073 
00074 
00075 
00076 if (&mydir == 2)
00077   {
00078   &junk = create_sprite(&mholdx, &mholdy, 11, 85, 1);
00079   sp_seq(&junk, 85); 
00080   sp_dir(&junk, 2);
00081   }
00082 
00083 if (&mydir == 7)
00084   {
00085   &mholdx -= 30;
00086   &junk = create_sprite(&mholdx, &mholdy, 11, 85, 1);
00087   sp_seq(&junk, 85); 
00088   sp_mx(&junk, -6);
00089   sp_my(&junk, -2);
00090 
00091   }
00092 
00093 
00094 if (&mydir == 8)
00095   {
00096   &junk = create_sprite(&mholdx, &mholdy, 11, 85, 1);
00097   sp_seq(&junk, 85); 
00098   sp_dir(&junk, 8);
00099   }
00100 
00101 if (&mydir == 9)
00102   {
00103   &mholdx += 30;
00104   &junk = create_sprite(&mholdx, &mholdy, 11, 85, 1);
00105   sp_seq(&junk, 85); 
00106   sp_mx(&junk, +6);
00107   sp_my(&junk, -2);
00108 
00109   }
00110 
00111 
00112 
00113 //create fake shadow effect
00114 
00115   sp_timing(&junk, 0);
00116   sp_speed(&junk, 6);
00117   
00118   sp_strength(&junk, 15);
00119   if (&strength > 25)
00120   {
00121      &stm = &strength;
00122      &stm -= 10;
00123      sp_strength(&junk, &stm);
00124    }
00125   sp_range(&junk, 10);
00126   //this makes it easier to hit stuff
00127   sp_flying(&junk, 1);
00128   sp_attack_hit_sound(&junk, 48);
00129   sp_attack_hit_sound_speed(&junk, 13000);
00130   &mshadow = create_sprite(&mholdx, &mholdy, 15, 432, 3);
00131   sp_brain_parm(&mshadow, &junk);
00132   sp_que(&mshadow, -500);
00133 
00134   //will be drawn under everything
00135 
00136   //set fireball to not be able to damage Dink or the shadow
00137   sp_brain_parm(&junk, 1);
00138   sp_brain_parm2(&junk, &mshadow);
00139 
00140 unfreeze(1);
00141 }
00142 
00143 void disarm(void)
00144 {
00145 kill_this_task();
00146 }
00147 
00148 void arm(void)
00149 {
00150 init("load_sequence_now graphics\dink\walk\ds-w1- 71 43 38 72 -14 -9 14 9");
00151 init("load_sequence_now graphics\dink\walk\ds-w2- 72 43 37 69 -13 -9 13 9");
00152 init("load_sequence_now graphics\dink\walk\ds-w3- 73 43 38 72 -14 -9 14 9");
00153 init("load_sequence_now graphics\dink\walk\ds-w4- 74 43 38 72 -12 -9 12 9");
00154 
00155 init("load_sequence_now graphics\dink\walk\ds-w6- 76 43 38 72 -13 -9 13 9");
00156 init("load_sequence_now graphics\dink\walk\ds-w7- 77 43 38 72 -12 -10 12 10");
00157 init("load_sequence_now graphics\dink\walk\ds-w8- 78 43 37 69 -13 -9 13 9");
00158 init("load_sequence_now graphics\dink\walk\ds-w9- 79 43 38 72 -14 -9 14 9");
00159 
00160 init("load_sequence_now graphics\dink\idle\ds-i2- 12 250 33 70 -12 -9 12 9");
00161 init("load_sequence_now graphics\dink\idle\ds-i4- 14 250 30 71 -11 -9 11 9");
00162 init("load_sequence_now graphics\dink\idle\ds-i6- 16 250 36 70 -11 -9 11 9");
00163 init("load_sequence_now graphics\dink\idle\ds-i8- 18 250 32 68 -12 -9 12 9");
00164 
00165 init("load_sequence_now graphics\dink\hit\normal\ds-h2- 102 75 60 72 -19 -9 19 9");
00166 init("load_sequence_now graphics\dink\hit\normal\ds-h4- 104 75 61 73 -19 -10 19 10");
00167 init("load_sequence_now graphics\dink\hit\normal\ds-h6- 106 75 58 71 -18 -10 18 10");
00168 init("load_sequence_now graphics\dink\hit\normal\ds-h8- 108 75 61 71 -19 -10 19 10");
00169 
00170 
00171 
00172 Debug("Preloading ice");
00173 
00174 int &basehit;
00175 int &mholdx;
00176 int &mholdy;
00177 int &junk;
00178 int &mshadow;
00179 int &mydir;
00180 preload_seq(85);
00181 preload_seq(94);
00182 }
00183 
00184 void pickup(void)
00185 {
00186 Debug("Player now owns this item.");
00187 kill_this_task();
00188 }
00189 
00190 void drop(void)
00191 {
00192 Debug("Item dropped.");
00193 kill_this_task();
00194 }
00195 
00196