Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
los
- To: crossfire (at) ifi.uio.no
- Subject: los
- From: Tony Elmroth <>
- Date: Sat, 26 Sep 92 22:44:57 +0200
Hi,
I think the line of sight is a good idea, but what you see
is little to restricted. Here is a patch that expand the sight
some more. For example you see the corners of rooms.
Tony
------------------------------cut here--------------------------------
*** ../tmp/crossfire-0.87.8/los.c Thu Sep 24 08:24:17 1992
--- los.c Sat Sep 26 19:15:50 1992
***************
*** 236,241 ****
--- 236,242 ----
#endif
}
+ #if 0
void expand_sight(object *op) {
int i,x,y;
for(x=0;x<11;x++)
***************
*** 251,256 ****
--- 252,281 ----
op->contr->blocked_los[dx][dy]=0;
}
}
+ #endif
+
+ void expand_sight(object *op)
+ {
+ int i,x,y, dx, dy;
+
+ for(x=1;x<10;x++) /* loop over inner squares */
+ for(y=1;y<10;y++)
+ if(!op->contr->blocked_los[x][y]&&
+ !blocks_view(op->map,op->x-5+x,op->y-5+y))
+ for(i=1;i<=8;i+=1) { /* mark all directions */
+ dx = x + freearr_x[i];
+ dy = y + freearr_y[i];
+ if(op->contr->blocked_los[dx][dy] > 0) /* for any square blocked */
+ op->contr->blocked_los[dx][dy]= -1;
+ }
+
+ /* clear mark squares */
+ for (x = 0; x < 11; x++)
+ for (y = 0; y < 11; y++)
+ if (op->contr->blocked_los[x][y] < 0)
+ op->contr->blocked_los[x][y] = 0;
+ }
+
void update_los(object *op) {
int i;