Changeset 494 for abuse/trunk/src/collide.cpp
- Timestamp:
- Apr 17, 2011, 11:56:44 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/collide.cpp
r490 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 51 52 { 52 53 collide_patch *next; 53 for (collide_patch *p=first; p;p=next)54 for (collide_patch *p=first; p; p=next) 54 55 { 55 56 next=p->next; … … 161 162 int32_t sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx=0,hity=0,t_centerx; 162 163 163 for (int l=0; l<attack_total;l++)164 for (int l=0; l<attack_total; l++) 164 165 { 165 166 subject=attack_list[l]; … … 168 169 169 170 170 for (int j=0; j<target_total && !rec;j++)171 { 172 target=target_list[j]; 171 for (int j=0; j<target_total && !rec; j++) 172 { 173 target=target_list[j]; 173 174 target->picture_space(tx1,ty1,tx2,ty2); 174 175 if (!(sx2<tx1 || sy2<ty1 || sx1>tx2 || sy1>ty2)) // check to see if picture spaces collide … … 181 182 t_centerx=target->x_center(); 182 183 point_list *s_hit,*t_damage; 183 184 184 185 s_hit=subject->current_figure()->hit; 185 186 … … 191 192 unsigned char *s_dat=s_hit->data,*t_dat; 192 193 int i,j; 193 for (i=(int)s_hit->tot-1; i>0 && !rec;i--)194 { 195 for (t_dat=t_damage->data,j=(int)t_damage->tot-1; j>0 && !rec;j--)194 for (i=(int)s_hit->tot-1; i>0 && !rec; i--) 195 { 196 for (t_dat=t_damage->data,j=(int)t_damage->tot-1; j>0 && !rec; j--) 196 197 { 197 198 int32_t x1,y1,x2,y2, // define the two line segments to check 198 199 xp1,yp1,xp2,yp2; 199 200 200 xp1=target->x+target->tx(*t_dat); t_dat++; 201 xp1=target->x+target->tx(*t_dat); t_dat++; 201 202 yp1=target->y+target->ty(*t_dat); t_dat++; 202 203 xp2=target->x+target->tx(*t_dat); … … 207 208 x2=subject->x+subject->tx(s_dat[2]); 208 209 y2=subject->y+subject->ty(s_dat[3]); 209 210 210 211 211 212 // ok, now we know which line segemnts to check for intersection 212 213 // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2) 213 int32_t _x2=x2,_y2=y2; 214 int32_t _x2=x2,_y2=y2; 214 215 setback_intersect(x1, y1, x2, y2, xp1, yp1, xp2, yp2,0); 215 216 … … 223 224 } 224 225 s_dat+=2; 225 } 226 } 226 227 } 227 228 }
Note: See TracChangeset
for help on using the changeset viewer.