Changeset 24 for ttyvaders/trunk/src/collide.c
 Timestamp:
 Dec 15, 2002, 6:16:45 PM (18 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

ttyvaders/trunk/src/collide.c
r20 r24 18 18 break; 19 19 case WEAPON_SEEKER: 20 case WEAPON_BOMB: 20 21 if( x <= t>left[y] 21 22  x >= t>right[y] ) 23 { 24 int damage = wp>type[i] == WEAPON_SEEKER ? 1 : 2; 25 26 add_explosion( g, ex, x, y, 0, 1, wp>type[i] == WEAPON_SEEKER ? EXPLOSION_SMALL : EXPLOSION_MEDIUM ); 27 28 if( x <= t>left[y] ) 29 { 30 t>right[y2] = damage  1; 31 t>left[y1] = damage; 32 t>left[y] = damage + 1; 33 t>left[y+1] = damage; 34 t>right[y+2] = damage  1; 35 } 36 else 37 { 38 t>right[y2] += damage  1; 39 t>right[y1] += damage; 40 t>right[y] += damage + 1; 41 t>right[y+1] += damage; 42 t>right[y+2] += damage  1; 43 } 44 45 wp>type[i] = WEAPON_NONE; 46 } 47 break; 48 case WEAPON_LASER: 49 if( x <= t>left[y+1] 50  x >= t>right[y+1] ) 51 { 52 add_explosion( g, ex, x, y+1, 0, 1, EXPLOSION_SMALL ); 53 54 if( x <= t>left[y+1] ) 55 { 56 t>left[y]; 57 t>left[y+1]=2; 58 t>left[y+2]; 59 } 60 else 61 { 62 t>right[y]++; 63 t>right[y+1]+=2; 64 t>right[y+2]++; 65 } 66 67 wp>type[i] = WEAPON_NONE; 68 } 69 else if( x <= t>left[y] 70  x >= t>right[y] ) 22 71 { 23 72 add_explosion( g, ex, x, y, 0, 1, EXPLOSION_SMALL ); … … 39 88 } 40 89 break; 41 case WEAPON_LASER:42 if( x <= t>left[y+1]43  x >= t>right[y+1] )44 {45 add_explosion( g, ex, x, y+1, 0, 1, EXPLOSION_SMALL );46 47 if( x <= t>left[y+1] )48 {49 t>left[y];50 t>left[y+1]=2;51 t>left[y+2];52 }53 else54 {55 t>right[y]++;56 t>right[y+1]+=2;57 t>right[y+2]++;58 }59 60 wp>type[i] = WEAPON_NONE;61 }62 else if( x <= t>left[y]63  x >= t>right[y] )64 {65 add_explosion( g, ex, x, y, 0, 1, EXPLOSION_SMALL );66 67 if( x <= t>left[y] )68 {69 t>left[y1];70 t>left[y]=2;71 t>left[y+1];72 }73 else74 {75 t>right[y1]++;76 t>right[y]+=2;77 t>right[y+1]++;78 }79 80 wp>type[i] = WEAPON_NONE;81 }82 break;83 90 case WEAPON_NUKE: 84 /* The nuke does not break the tunnel */ 91 case WEAPON_BEAM: 92 /* The nuke and the laser do not break the tunnel */ 85 93 break; 86 94 } … … 127 135 } 128 136 break; 137 case WEAPON_BEAM: 138 r = (29  wp>n[i]) * (29  wp>n[i]) / 8; 139 140 for( j = 0; j < ALIENS; j++ ) 141 { 142 if( al>type[j] == ALIEN_NONE ) 143 { 144 continue; 145 } 146 147 if( x >= al>x[j] && x <= al>x[j] + 4 148 && y >= al>y[j] + 2 && y5r <= al>y[j] ) 149 { 150 al>life[j] = 4; 151 if( al>life[j] <= 0 ) 152 { 153 al>type[j] = ALIEN_NONE; 154 add_explosion( g, ex, al>x[j], al>y[j], 0, 0, EXPLOSION_MEDIUM ); 155 add_bonus( g, g>bo, al>x[j], al>y[j], GET_RAND(0,5) ? BONUS_GREEN : BONUS_LIFE ); 156 } 157 } 158 } 159 break; 160 129 161 case WEAPON_LASER: 130 162 for( j = 0; j < ALIENS; j++ ) … … 142 174 { 143 175 al>type[j] = ALIEN_NONE; 144 add_explosion( g, ex, x, y, 0, 0, EXPLOSION_MEDIUM );145 add_bonus( g, g>bo, x, y, GET_RAND(0,5) ? BONUS_GREEN : BONUS_LIFE );176 add_explosion( g, ex, al>x[j], al>y[j], 0, 0, EXPLOSION_MEDIUM ); 177 add_bonus( g, g>bo, al>x[j], al>y[j], GET_RAND(0,5) ? BONUS_GREEN : BONUS_LIFE ); 146 178 } 147 179 ok = 1; … … 154 186 { 155 187 al>type[j] = ALIEN_NONE; 156 add_explosion( g, ex, x, y+1, 0, 0, EXPLOSION_MEDIUM );157 add_bonus( g, g>bo, x, y+1, GET_RAND(0,5) ? BONUS_GREEN : BONUS_LIFE );188 add_explosion( g, ex, al>x[j], al>y[j]+1, 0, 0, EXPLOSION_MEDIUM ); 189 add_bonus( g, g>bo, al>x[j], al>y[j]+1, GET_RAND(0,5) ? BONUS_GREEN : BONUS_LIFE ); 158 190 } 159 191 ok = 1; … … 163 195 if( ok ) 164 196 { 197 add_explosion( g, ex, x, y+1, 0, 0, EXPLOSION_SMALL ); 165 198 wp>type[i] = WEAPON_NONE; 166 199 } … … 168 201 169 202 case WEAPON_SEEKER: 203 case WEAPON_BOMB: 170 204 for( j = 0; j < ALIENS; j++ ) 171 205 { … … 182 216 { 183 217 al>type[j] = ALIEN_NONE; 184 add_explosion( g, ex, x, y, 0, 0, EXPLOSION_MEDIUM );185 add_bonus( g, g>bo, x, y, GET_RAND(0,5) ? BONUS_GREEN : BONUS_LIFE );218 add_explosion( g, ex, al>x[j], al>y[j], 0, 0, EXPLOSION_MEDIUM ); 219 add_bonus( g, g>bo, al>x[j], al>y[j], GET_RAND(0,5) ? BONUS_GREEN : BONUS_LIFE ); 186 220 } 187 221 ok = 1; … … 191 225 if( ok ) 192 226 { 227 add_explosion( g, ex, x, y+1, 0, 0, wp>type[i] == WEAPON_SEEKER ? EXPLOSION_SMALL : EXPLOSION_MEDIUM ); 193 228 wp>type[i] = WEAPON_NONE; 194 229 }
Note: See TracChangeset
for help on using the changeset viewer.