 Timestamp:
 Dec 23, 2002, 12:39:15 AM (20 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

libcaca/trunk/src/weapons.c
r45 r47 4 4 * All Rights Reserved 5 5 * 6 * $Id: weapons.c,v 1.1 0 2002/12/22 23:01:35 sam Exp $6 * $Id: weapons.c,v 1.11 2002/12/22 23:39:15 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 139 139 wp>n[i]; 140 140 141 /* Estimate our position in 2frames */142 xnew = wp>x[i] + 4 *wp>vx[i];143 ynew = wp>y[i] + 4 *wp>vy[i];141 /* Estimate our position next frames */ 142 xnew = wp>x[i] + wp>vx[i]; 143 ynew = wp>y[i] + wp>vy[i]; 144 144 145 145 xmin = xnew; … … 170 170 dy = ymin  wp>y[i]; 171 171 172 /* Normalize and update speed*/172 /* Normalize direction */ 173 173 if( dx  dy ) 174 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 } 175 int norm = r00t( dx * dx + 4 * dy * dy ); 176 dx = dx * 32 / norm; 177 dy = dy * 32 / norm; 178 } 179 180 /* Find our new speed */ 181 dx = (dx + 3 * wp>vx[i]) / 4; 182 dy = (dy + 3 * wp>vy[i]) / 4; 183 184 /* Normalize speed */ 185 if( dx  dy ) 186 { 187 int norm = r00t( dx * dx + 4 * dy * dy ); 188 wp>vx[i] = dx * 32 / norm; 189 wp>vy[i] = dy * 32 / norm; 190 } 191 180 192 break; 181 193 … … 186 198 int coords[] = 187 199 { 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 200 32, 0, 32, 0, 0, 16, 0, 16, 201 24, 12, 24, 12, 24, 12, 24, 12, 202 28, 8, 28, 8, 28, 8, 28, 8, 203 16, 14, 16, 14, 16, 14, 16, 14 191 204 }; 192 205 193 for( j = 0 ; j < 12; j++)206 for( j = 0 ; j < sizeof(coords) / sizeof(int) ; j += 2 ) 194 207 { 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 );208 add_weapon( g, g>wp, wp>x[i] + coords[j], wp>y[i] + coords[j+1], coords[j], coords[j+1], WEAPON_SEEKER ); 196 209 } 197 210
Note: See TracChangeset
for help on using the changeset viewer.