Back to index

freedink-data  1.08.20080920
ITEM-PIG.c
Go to the documentation of this file.
00001 //item pig food
00002 
00003 void use( void )
00004 {
00005 //disallow diagonal punches
00006 &dir = sp_dir(1, -1);
00007 if (&dir == 1)
00008 {
00009     &dir = 2;
00010 }
00011 if (&dir == 3)
00012 {
00013     &dir = 2;
00014 }
00015 if (&dir == 7)
00016 {
00017     &dir = 8;
00018 }
00019 if (&dir == 9)
00020 {
00021     &dir = 8;
00022 }
00023 sp_dir(1, &dir);
00024 
00025 &basehit = sp_dir(1, -1);
00026 &basehit += 520;
00027 //520 is the 'base' for the hit animations, we just add
00028 //the direction
00029 sp_seq(1, &basehit);
00030 sp_frame(1, 1); //reset seq to 1st frame
00031 sp_kill_wait(1); //make sure dink will punch right away
00032 sp_nocontrol(1, 1); //dink can't move until anim is done!
00033 wait(250);
00034 playsound(13, 8000,0,0,0);
00035 
00036  &mholdx = sp_x(1, -1);
00037  &mholdy = sp_y(1, -1);
00038 wait(10);
00039 
00040 if (&dir == 4)
00041   {
00042     &mholdy -= 37; 
00043       &mholdx -= 50;
00044    &junk = create_sprite(&mholdx, &mholdy, 5, 430, 1);
00045 sp_seq(&junk, 430);
00046   }
00047 wait(10);
00048 
00049 if (&dir == 6)
00050   {
00051     &mholdy -= 20; 
00052     &mholdx += 50;
00053    &junk = create_sprite(&mholdx, &mholdy, 5, 431, 1);
00054   sp_seq(&junk, 431); 
00055   }
00056 
00057 if (&dir == 8)
00058   {
00059     &mholdy -= 50; 
00060     &mholdx += 8;
00061    &junk = create_sprite(&mholdx, &mholdy, 5, 430, 1);
00062   sp_seq(&junk, 430); 
00063   }
00064 
00065 if (&dir == 2)
00066   {
00067   //  &mholdy += 0; 
00068     &mholdx -= 2;
00069    &junk = create_sprite(&mholdx, &mholdy, 5, 431, 1);
00070   sp_seq(&junk, 431); 
00071   }
00072 
00073 
00074  if (&pig_story != 0) return;
00075 
00076  if (&player_map == 407)
00077    {
00078     //they are feeding the pigs.. maybe...
00079 
00080 &junk = inside_box(&mholdx,&mholdy, 200, 180, 400, 306);
00081     if (&junk == 1)
00082     {
00083     freeze(1);
00084      wait(200);
00085      Say_stop("Come on pigs, eat!", 1);
00086   //lets create the bully, and run his script
00087         &junk = create_sprite(680, 200, 0, 341, 1);
00088         sp_script(&junk, "s1-bul");
00089 
00090     }
00091 
00092    }
00093 
00094 }
00095 
00096 void disarm(void)
00097 {
00098 kill_this_task();
00099 }
00100 
00101 void arm(void)
00102 {
00103 int &basehit;
00104 int &mholdx;
00105 int &mholdy;
00106 int &junk;
00107 int &dir;
00108 
00109 init("load_sequence_now graphics\dink\walk\ds-w1- 71 35 38 72");
00110 init("load_sequence_now graphics\dink\walk\ds-w2- 72 35 37 69 -13 -9 13 9");
00111 init("load_sequence_now graphics\dink\walk\ds-w3- 73 35 38 72");
00112 init("load_sequence_now graphics\dink\walk\ds-w4- 74 35 38 72");
00113 
00114 init("load_sequence_now graphics\dink\walk\ds-w6- 76 35 38 72");
00115 init("load_sequence_now graphics\dink\walk\ds-w7- 77 35 38 72");
00116 init("load_sequence_now graphics\dink\walk\ds-w8- 78 35 37 69 -13 -9 13 9");
00117 init("load_sequence_now graphics\dink\walk\ds-w9- 79 35 38 72");
00118 
00119 init("load_sequence_now graphics\dink\idle\ds-i2- 12 250 33 70 -12 -9 12 9");
00120 init("load_sequence_now graphics\dink\idle\ds-i4- 14 250 30 71 -11 -9 11 9");
00121 init("load_sequence_now graphics\dink\idle\ds-i6- 16 250 36 70 -11 -9 11 9");
00122 init("load_sequence_now graphics\dink\idle\ds-i8- 18 250 32 68 -12 -9 12 9");
00123 
00124 
00125 preload_seq(522);
00126 preload_seq(524);
00127 preload_seq(526);
00128 preload_seq(528);
00129 preload_seq(430);
00130 preload_seq(431);
00131 }
00132 
00133 void pickup(void)
00134 {
00135 kill_this_task();
00136 }
00137 
00138 void drop(void)
00139 {
00140 kill_this_task();
00141 }