version 1.52 | | version 1.53 |
---|
| | |
/* | | /* |
* static char *rcsid_init_c = | | * static char *rcsid_init_c = |
* "$Id: request.c,v 1.52 2003/09/13 05:02:14 mwedel Exp $"; | | * "$Id: request.c,v 1.53 2003/10/08 07:20:37 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
* - Use the animation elements from 0 to 8 for smoothing. | | * - Use the animation elements from 0 to 8 for smoothing. |
*/ | | */ |
void AskSmooth (char *buf, int len, NewSocket *ns){ | | void AskSmooth (char *buf, int len, NewSocket *ns){ |
char* name; | | |
char* defaultsmooth="default_smoothed.111"; | | char* defaultsmooth="default_smoothed.111"; |
char smoothname[MAX_BUF]; | | |
char reply[MAX_BUF]; | | char reply[MAX_BUF]; |
SockList sl; | | SockList sl; |
int i; | | |
archetype* at; | | |
uint16 smoothface; | | uint16 smoothface; |
int facenbr; | | int facenbr; |
facenbr=atoi (buf); | | facenbr=atoi (buf); |
| | |
* it was. | | * it was. |
* sl is the socklist this data is going into. | | * sl is the socklist this data is going into. |
* ns is the socket we are working on - all the info we care | | * ns is the socket we are working on - all the info we care |
* about is in this socket structure, so know need to pass the | | * about is in this socket structure, so now need not pass the |
* entire player object. | | * entire player object. |
* mx and my are map coordinate offsets for map mp | | * mx and my are map coordinate offsets for map mp |
* sx and sy are the offsets into the socket structure that | | * sx and sy are the offsets into the socket structure that |
* holds the old values. | | * holds the old values. |
* layer is the layer to update, with 2 being the floor and 0 the | | * layer is the layer to update, with 2 being the floor and 0 the |
* top layer (this matches what the GET_MAP_FACE and GET_MAP_FACE_OBJ | | * top layer (this matches what the GET_MAP_FACE and GET_MAP_FACE_OBJ) |
* take. Interesting to note that before this function, the map1 function | | * take. Interesting to note that before this function, the map1 function |
* numbers the spaces differently - I think this was a leftover from | | * numbers the spaces differently - I think this was a leftover from |
* the map command, where the faces stack up. Sinces that is no longer | | * the map command, where the faces stack up. Sinces that is no longer |
| | |
* 1) the heads[] values will get used even if the space is not visible. | | * 1) the heads[] values will get used even if the space is not visible. |
* 2) its possible the head is not on the same map as a part, and I'd | | * 2) its possible the head is not on the same map as a part, and I'd |
* rather not need to do the map translation overhead. | | * rather not need to do the map translation overhead. |
| | * 3) We need to do some extra checking to make sure that we will |
| | * otherwise send the image as this layer, eg, either it matches |
| | * the head value, or is not multipart. |
*/ | | */ |
if (head) { | | if (head) { |
for (i=0; i<MAP_LAYERS; i++) | | for (i=0; i<MAP_LAYERS; i++) { |
if (GET_MAP_FACE_OBJ(mp, mx, my, i) && | | ob = GET_MAP_FACE_OBJ(mp, mx, my, i); |
GET_MAP_FACE_OBJ(mp, mx, my, i)->face == head->face) { | | if (!ob) continue; |
| | |
| | if (ob->head) ob=ob->head; |
| | |
| | if (ob->face == head->face && |
| | (ob == head && !ob->more)) { |
heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer] = NULL; | | heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer] = NULL; |
head = NULL; | | head = NULL; |
break; | | break; |
} | | } |
} | | } |
| | } |
| | |
ob = head; | | ob = head; |
if (!ob) ob = GET_MAP_FACE_OBJ(mp, mx, my, layer); | | if (!ob) ob = GET_MAP_FACE_OBJ(mp, mx, my, layer); |
| | |
} | | } |
} /* else not already head object or blank face */ | | } /* else not already head object or blank face */ |
| | |
| | /* This is a real hack. Basically, if we have nothing to send for this layer, |
| | * but there is a head on the next layer, send that instead. |
| | * Without this, what happens is you can get the case where the player stands |
| | * on the same space as the head. However, if you have overlapping big objects |
| | * of the same type, what happens then is it doesn't think it needs to send |
| | * This tends to make stacking also work/look better. |
| | */ |
| | if (!face_num && layer > 0 && heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer -1]) { |
| | face_num = heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer -1]->face->number; |
| | heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer -1] = NULL; |
| | } |
| | |
| | /* Another hack - because of heads and whatnot, this face may match one |
| | * we already sent for a lower layer. In that case, don't send |
| | * this one. |
| | */ |
| | if (face_num && layer<MAP_LAYERS && ns->lastmap.cells[sx][sy].faces[layer+1] == face_num) { |
| | face_num = 0; |
| | } |
| | |
/* We've gotten what face we want to use for the object. Now see if | | /* We've gotten what face we want to use for the object. Now see if |
* if it has changed since we last sent it to the client. | | * if it has changed since we last sent it to the client. |
*/ | | */ |
| | |
{ | | { |
object *ob, *head; | | object *ob, *head; |
int smoothlevel; /* old face_num;*/ | | int smoothlevel; /* old face_num;*/ |
int bx, by,i; | | |
| | |
/* If there is a multipart object stored away, treat that as more important. | | /* If there is a multipart object stored away, treat that as more important. |
* If not, then do the normal processing. | | * If not, then do the normal processing. |
| | |
*/ | | */ |
if (ax >= pl->contr->socket.mapx || ay >= pl->contr->socket.mapy) { | | if (ax >= pl->contr->socket.mapx || ay >= pl->contr->socket.mapy) { |
oldlen = sl.len; | | oldlen = sl.len; |
| | |
if (pl->contr->socket.ext_mapinfos){ | | if (pl->contr->socket.ext_mapinfos){ |
SockList_AddShort(&esl, emask); | | SockList_AddShort(&esl, emask); |
} | | } |
| | |
eoldlen = esl.len; | | eoldlen = esl.len; |
emask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4; | | emask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4; |
SockList_AddShort(&sl, mask); | | SockList_AddShort(&sl, mask); |
| | |
if (pl->contr->socket.ext_mapinfos) | | if (pl->contr->socket.ext_mapinfos) |
SockList_AddShort(&esl, emask); | | SockList_AddShort(&esl, emask); |
| | |
| | |
/* Middle face */ | | /* Middle face */ |
if (update_space(&sl, &pl->contr->socket, m, nx, ny, ax, ay, 1)) | | if (update_space(&sl, &pl->contr->socket, m, nx, ny, ax, ay, 1)) |
mask |= 0x2; | | mask |= 0x2; |
| | |
if (pl->contr->socket.EMI_smooth) | | if (pl->contr->socket.EMI_smooth) |
if (update_smooth(&esl, &pl->contr->socket, m, nx, ny, ax, ay, 1)){ | | if (update_smooth(&esl, &pl->contr->socket, m, nx, ny, ax, ay, 1)){ |
emask |= 0x2; | | emask |= 0x2; |
| | |
*/ | | */ |
for(x=0; x<mx; x++) { | | for(x=0; x<mx; x++) { |
for(y=0; y<my; y++) { | | for(y=0; y<my; y++) { |
if ((x+dx) < 0 || x >= ns->mapx || (y+dy) < 0 || y >= ns->mapy) { | | if ((x+dx) < 0 || (x+dx) >= ns->mapx || (y+dy) < 0 || (y + dy) >= ns->mapy) { |
memset(&(newmap.cells[x][y]), 0, sizeof(struct MapCell)); | | memset(&(newmap.cells[x][y]), 0, sizeof(struct MapCell)); |
} | | } |
else { | | else { |
| | |
} | | } |
} | | } |
} | | } |
| | |
memcpy(&(ns->lastmap), &newmap,sizeof(struct Map)); | | memcpy(&(ns->lastmap), &newmap,sizeof(struct Map)); |
ns->sent_scroll = 1; | | ns->sent_scroll = 1; |
} | | } |