 Timestamp:
 Dec 23, 2002, 12:01:35 AM (17 years ago)
 Location:
 ttyvaders/trunk/src
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

ttyvaders/trunk/src/math.c
r44 r46 4 4 * All Rights Reserved 5 5 * 6 * $Id: math.c,v 1. 1 2002/12/22 22:36:42sam Exp $6 * $Id: math.c,v 1.2 2002/12/22 23:01:35 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 27 27 int x = a > 100000 ? 1000 : a > 1000 ? 100 : a > 10 ? 10 : 1; 28 28 29 /* Newton's method. Three iterations are more than enough. */ 29 if( a <= 0 ) 30 { 31 return 0; 32 } 33 34 /* Newton's method. Three iterations would be more than enough. */ 30 35 x = (x * x + a) / x / 2; 31 36 x = (x * x + a) / x / 2; 
ttyvaders/trunk/src/weapons.c
r44 r46 4 4 * All Rights Reserved 5 5 * 6 * $Id: weapons.c,v 1. 9 2002/12/22 22:36:42sam Exp $6 * $Id: weapons.c,v 1.10 2002/12/22 23:01:35 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 171 171 172 172 /* Normalize and update speed */ 173 wp>vx[i] = (7 * wp>vx[i] 174 + (dx * 48) / r00t(dx*dx+dy*dy) ) / 8; 175 wp>vy[i] = (7 * wp>vy[i] 176 + (dy * 24) / r00t(dx*dx+dy*dy) ) / 8; 177 178 break; 173 if( dx  dy ) 174 { 175 int norm = r00t( dx * dx + dy * dy ); 176 177 wp>vx[i] = (7 * wp>vx[i] + (dx * 48) / norm ) / 8; 178 wp>vy[i] = (7 * wp>vy[i] + (dy * 24) / norm ) / 8; 179 } 180 break; 181 179 182 case WEAPON_FRAGBOMB: 180 /* If n was set to 1, the fragbomb exploded */183 /* If n was set to 1, the fragbomb just exploded */ 181 184 if( wp>n[i] == 1 ) 182 185 { 183 add_weapon( g, g>wp, wp>x[i] + 24, wp>y[i], 24, 0, WEAPON_SEEKER );184 add_weapon( g, g>wp, wp>x[i]  24, wp>y[i], 24, 0, WEAPON_SEEKER );185 add_weapon( g, g>wp, wp>x[i], wp>y[i] + 24, 0, 24, WEAPON_SEEKER );186 add_weapon( g, g>wp, wp>x[i], wp>y[i]  24, 0, 24, WEAPON_SEEKER );187 add_weapon( g, g>wp, wp>x[i] + 24, wp>y[i] + 8, 24, 8, WEAPON_SEEKER );188 add_weapon( g, g>wp, wp>x[i]  24, wp>y[i] + 8, 24, 8, WEAPON_SEEKER );189 add_weapon( g, g>wp, wp>x[i] + 24, wp>y[i]  8, 24, 8, WEAPON_SEEKER ); 190 add_weapon( g, g>wp, wp>x[i]  24, wp>y[i]  8, 24, 8, WEAPON_SEEKER );191 add_weapon( g, g>wp, wp>x[i] + 16, wp>y[i] + 16, 16, 16, WEAPON_SEEKER );192 add_weapon( g, g>wp, wp>x[i]  16, wp>y[i] + 16, 16, 16, WEAPON_SEEKER );193 add_weapon( g, g>wp, wp>x[i] + 16, wp>y[i]  16, 16, 16, WEAPON_SEEKER );194 add_weapon( g, g>wp, wp>x[i]  16, wp>y[i]  16, 16, 16, WEAPON_SEEKER ); 186 int coords[] = 187 { 188 24, 0, 24, 0, 0, 24, 0, 24, 189 24, 8, 24, 8, 24, 8, 24, 8, 190 16, 16, 16, 16, 16, 16, 16, 16 191 }; 192 193 for( j = 0; j < 12; j++ ) 194 { 195 add_weapon( g, g>wp, wp>x[i] + coords[2*j], wp>y[i] + coords[2*j+1], coords[2*j], coords[2*j+1], WEAPON_SEEKER ); 196 } 197 195 198 wp>type[i] = WEAPON_NONE; 196 199 } … … 204 207 } 205 208 break; 209 206 210 case WEAPON_BEAM: 207 211 wp>x[i] = (g>p>x + 2) << 4;
Note: See TracChangeset
for help on using the changeset viewer.