NCURSES_SP_NAME(getmouse) (NCURSES_SP_DCLx MEVENT * aevent) { int result = ERR; T((T_CALLED("getmouse(%p,%p)"), (void *) SP_PARM, (void *) aevent)); if ((aevent != 0) && (SP_PARM != 0) && (SP_PARM->_mouse_type != M_NONE)) { MEVENT *eventp = SP_PARM->_mouse_eventp; /* compute the current-event pointer */ MEVENT *prev = PREV(eventp); if (prev->id != INVALID_EVENT) { /* copy the event we find there */ *aevent = *prev; TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld", _nc_tracemouse(SP_PARM, prev), (long) IndexEV(SP_PARM, prev))); prev->id = INVALID_EVENT; /* so the queue slot becomes free */ SP_PARM->_mouse_eventp = PREV(prev); result = OK; } } returnCode(result); }
edict_t * PlayerTrail_PickFirst(edict_t *self) { int marker; int n; if (!trail_active) { return NULL; } for (marker = trail_head, n = TRAIL_LENGTH; n; n--) { if (trail[marker]->timestamp <= self->monsterinfo.trail_time) { marker = NEXT(marker); } else { break; } } if (visible(self, trail[marker])) { return trail[marker]; } if (visible(self, trail[PREV(marker)])) { return trail[PREV(marker)]; } return trail[marker]; }
short int swap(Triangle * a, Triangle * b){ int ua, ub; for(ua=0; ua<3 && IN_TRIA(b, a->points[ua]); ++ua); for(ub=0; ub<3 && IN_TRIA(a, b->points[ub]); ++ub); if(ua==3 || ub==3) return -1; a->points[NEXT(ua)] = b->points[ub]; b->points[b->points[NEXT(ub)] == a->points[PREV(ua)] ? NEXT(ub) : PREV(ub)] = a->points[ua]; return 1; }
static void findstats(Pos p, Ori o) { /* Recalculate cross assert and score total at 'p' */ Pos left, right; Word lword, rword; Node n; Edge e; int s; lword.n = rword.n = 0; if(EDGE(p)) return; /* find word to the left */ s = 0; for(left=PREV(p,o); HASLETTER(left); left = PREV(left,o)) ; left = NEXT(left,o); while (HASLETTER(left)) { lword.c[lword.n++] = LETTER(left); s += SCORE(left); left = NEXT(left,o); } /* find word to the right */ for(right=NEXT(p,o); HASLETTER(right); right = NEXT(right,o)) { rword.c[rword.n++] = LETTER(right); s += SCORE(right); } if(DBG) { wordprint(&lword); print("X"); wordprint(&rword); print(" [%d] ", s); } SIDE(p,o) = s; ISANCHOR(p) = true; /* calculate cross asserts */ CROSS(p,o) = 0; n = traverse(root, &lword, 0); assert(n>=0); if(n>0) do { e = dict[n++]; if ( (rword.n && isword(NODE(e), &rword)) || (!rword.n && TERM(e)) ) { CROSS(p,o) |= 1 << LET(e); DPRINT("%c, ", LET(e)+'a'); } } while (!(LAST(e))); DPRINT("\n"); }
bool_t xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead) { mntfs *mf; u_int len = 0; /* * Compute length of list */ for (mf = AM_LAST(mntfs, qhead); mf != HEAD(mntfs, qhead); mf = PREV(mntfs, mf)) { if (!(mf->mf_fsflags & FS_AMQINFO)) continue; len++; } xdr_u_int(xdrs, &len); /* * Send individual data items */ for (mf = AM_LAST(mntfs, qhead); mf != HEAD(mntfs, qhead); mf = PREV(mntfs, mf)) { int up; if (!(mf->mf_fsflags & FS_AMQINFO)) continue; if (!xdr_amq_string(xdrs, &mf->mf_ops->fs_type)) { return (FALSE); } if (!xdr_amq_string(xdrs, &mf->mf_mount)) { return (FALSE); } if (!xdr_amq_string(xdrs, &mf->mf_info)) { return (FALSE); } if (!xdr_amq_string(xdrs, &mf->mf_server->fs_host)) { return (FALSE); } if (!xdr_int(xdrs, &mf->mf_error)) { return (FALSE); } if (!xdr_int(xdrs, &mf->mf_refc)) { return (FALSE); } if (FSRV_ERROR(mf->mf_server) || FSRV_ISDOWN(mf->mf_server)) up = 0; else if (FSRV_ISUP(mf->mf_server)) up = 1; else up = -1; if (!xdr_int(xdrs, &up)) { return (FALSE); } } return (TRUE); }
/*** Go through the next word ***/ void NextLink( AGNode src, char dir ) { if( dir == 1) if( src->ActiveLink ) src->ActiveLink = NEXT(src->ActiveLink); else src->ActiveLine++, src->ActiveLink = WordsPara( src->StartLine = NEXT(src->StartLine) ); else if( src->ActiveLink ) src->ActiveLink = PREV(src->ActiveLink); else src->ActiveLine--, src->ActiveLink = EndOfLine( src->StartLine = PREV(src->StartLine) ); }
int main(int argc, char *argv[]) { #define COUNT (10) struct mydata data[COUNT]; int i; struct mydata *pcur, *plast = data; INIT_LIST(plast); plast->data1 = -222; plast->data2 = -999000.0; for(i=1; i<COUNT; i++) { pcur = data + i; INIT_LIST(pcur); pcur->data1 = i; pcur->data2 = i + 999300.0; ADD_AFTER(plast, pcur); plast = NEXT(plast); } struct mydata *ptr = data; while(ptr) { printf("data1=%d, data2=%f\n", ptr->data1, ptr->data2); ptr = NEXT(ptr); } ptr = data + COUNT - 1; while(ptr) { printf("data1=%d, data2=%f\n", ptr->data1, ptr->data2); ptr = PREV(ptr); } return 0; }
// Insert a new vertex static void insert_vert(TriMesh *mesh, int scheme, int f, int e) { int v1 = mesh->faces[f][NEXT(e)], v2 = mesh->faces[f][PREV(e)]; if (scheme == SUBDIV_PLANAR) { point p = 0.5f * (mesh->vertices[v1] + mesh->vertices[v2]); mesh->vertices.push_back(p); return; } int ae = mesh->across_edge[f][e]; if (ae == -1) { // Boundary point p = 0.5f * (mesh->vertices[v1] + mesh->vertices[v2]); if (scheme == SUBDIV_BUTTERFLY || scheme == SUBDIV_BUTTERFLY_MODIFIED) { p *= 1.5f; p -= 0.25f * (avg_bdy(mesh, v1) + avg_bdy(mesh, v2)); } mesh->vertices.push_back(p); return; } int v0 = mesh->faces[f][e]; const TriMesh::Face &aef = mesh->faces[ae]; int v3 = aef[NEXT(aef.indexof(v1))]; point p; if (scheme == SUBDIV_LOOP || scheme == SUBDIV_LOOP_ORIG) { p = loop(mesh, f, ae, v0, v1, v2, v3); } else if (scheme == SUBDIV_LOOP_NEW) { bool e1 = (mesh->adjacentfaces[v1].size() != 6); bool e2 = (mesh->adjacentfaces[v2].size() != 6); if (e1 && e2) p = 0.5f * (new_loop_edge(mesh, f, ae, v0, v1, v2, v3) + new_loop_edge(mesh, ae, f, v3, v2, v1, v0)); else if (e1) p = new_loop_edge(mesh, f, ae, v0, v1, v2, v3); else if (e2) p = new_loop_edge(mesh, ae, f, v3, v2, v1, v0); else p = loop(mesh, f, ae, v0, v1, v2, v3); } else if (scheme == SUBDIV_BUTTERFLY) { p = butterfly(mesh, f, ae, v0, v1, v2, v3); } else if (scheme == SUBDIV_BUTTERFLY_MODIFIED) { bool e1 = (mesh->adjacentfaces[v1].size() != 6); bool e2 = (mesh->adjacentfaces[v2].size() != 6); if (e1 && e2) p = 0.5f * (zorin_edge(mesh, f, ae, v0, v1, v2, v3) + zorin_edge(mesh, ae, f, v3, v2, v1, v0)); else if (e1) p = zorin_edge(mesh, f, ae, v0, v1, v2, v3); else if (e2) p = zorin_edge(mesh, ae, f, v3, v2, v1, v0); else p = butterfly(mesh, f, ae, v0, v1, v2, v3); } mesh->vertices.push_back(p); }
void ft_think(t_env *e, int l, int i) { int c; int rt; c = 0; rt = THINK_T * TT; e->i_state[i] = 0; e->state[i] = ft_strdup(THINK); while (c < rt) { if (ft_is_dead(e) != 0) e->roll = 3; if ((c % TT) == 0) e->hp[i] -= 1; if (e->i_state[NEXT(i)] == 1 || e->i_state[PREV(i)] == 1) { UNLOCK(&e->lock[l]); return (ft_rest(e, i, c)); } usleep(TS); if (e->roll == 3) break ; c++; } UNLOCK(&e->lock[l]); }
short int legalizeEdge(Point * p, Triangle * T){ short int ut, ua; Triangle * A; Point * center; for(ut=0; ut<3 && T->points[ut] != p; ++ut); if(ut==3) return -1; ADJACENT(T, T->points[NEXT(ut)], T->points[PREV(ut)], A); if(!A) return 1; for(ua=0; ua<3 && IN_TRIA(T, A->points[ua]); ua++); center = calcCenter(T); if(!center) return -2; if(DISQR(A->points[ua], center) >= DISQR(center, P0)){ free(center); return 1; } free(center); if((ua=swap(T, A))<0) return -3; if((ua=legalizeEdge(p, T))<0) return -ua; if((ua=legalizeEdge(p, A))<0) return -ua; return 1; }
int movelines ( char *linespec , double_list *p_head, double_list *p_current ) { double_list startnode, endnode, tmpnode ; int startnumber, endnumber, rc, currentnumber, tmp; rc = parse_linespec( linespec, *p_head, *p_current, &startnode, &endnode ) ; if( rc ) return rc ; startnumber = double_node_number( startnode ) ; endnumber = double_node_number( endnode ) ; currentnumber = double_node_number( *p_current ) ; if( startnumber > endnumber ) { tmp = startnumber ; startnumber = endnumber ; endnumber = tmp ; tmpnode = startnode ; startnode = endnode ; endnode = tmpnode ; } if(( currentnumber >= startnumber ) && ( currentnumber <= endnumber )) return E_LINES; cut_list( p_head, &startnode, &endnode ) ; paste_list( &PREV( *p_current ), &startnode ) ; return 0; }
static void txstart(Ether *edev) { int tdh, tdt; Ctlr *ctlr = edev->ctlr; Block *bp; Tdesc *tdesc; /* * Try to fill the ring back up, moving buffers from the transmit q. */ tdh = PREV(ctlr->tdh, Ntdesc); for(tdt = ctlr->tdt; tdt != tdh; tdt = NEXT(tdt, Ntdesc)){ /* pull off the head of the transmission queue */ if((bp = ctlr->bqhead) == nil) /* was qget(edev->oq) */ break; ctlr->bqhead = bp->next; if (ctlr->bqtail == bp) ctlr->bqtail = nil; /* set up a descriptor for it */ tdesc = &ctlr->tdba[tdt]; tdesc->addr[0] = PCIWADDR(bp->rp); tdesc->addr[1] = 0; tdesc->control = /* Ide | */ Rs | Ifcs | Teop | BLEN(bp); ctlr->tb[tdt] = bp; } ctlr->tdt = tdt; csr32w(ctlr, Tdt, tdt); i82563im(ctlr, Txdw); }
/* * mm_realloc - Implemented simply in terms of mm_malloc and mm_free */ void *mm_realloc(void *ptr, size_t size) { size_t asize; //adjusted block size if (size <= DSIZE) asize = 2*DSIZE; else asize = DSIZE * ((size + (DSIZE)+(DSIZE-1))/DSIZE); size_t oldSize=GET_SIZE(HDRP(ptr)); size_t nextSize=GET_SIZE(HDRP(NEXT_BLKP(ptr))); //if two blocks can fit, then we just return the original ptr and adjust the size if(!GET_ALLOC(HDRP(NEXT_BLKP(ptr)))){ if(asize < (oldSize+nextSize-2*DSIZE)){ void *bp=ptr; void* prevfree=PREV(NEXT_BLKP(ptr)); void* nextfree=NEXT(NEXT_BLKP(ptr)); PUT(HDRP(bp),PACK(asize,1)); PUT(FTRP(bp),PACK(asize,1)); bp=(char*)bp+asize; PUT(HDRP(bp),PACK(oldSize+nextSize-asize,0)); PUT(FTRP(bp),PACK(oldSize+nextSize-asize,0)); PUT(bp,prevfree); if(prevfree) PUT(SUC(prevfree),bp); if(nextfree) PUT(nextfree,bp); else endfree=bp; return ptr; } } //else... void *oldptr = ptr; size_t copySize; void *newptr; if(ptr == NULL) return mm_malloc(size); if (asize==0) { mm_free(oldptr); return NULL; } else{ newptr = mm_malloc(size); if (newptr == NULL) return NULL; copySize = GET_SIZE(HDRP(oldptr)); if (asize < copySize) copySize = asize; memcpy(newptr, oldptr, copySize-WSIZE); mm_free(oldptr); return newptr; } }
void cmd_goto_left(CmdContext *c, CmdParams *p) { gint i; gint start_pos = p->line_start_pos; gint pos = p->pos; for (i = 0; i < p->num && pos > start_pos; i++) pos = PREV(p->sci, pos); SET_POS(p->sci, pos, TRUE); }
// get the element count in the doubly linked list // will calculate both two directions in the list int Ins_count(const Ins *n) { if( !n ) return 0; int i = 0; const Ins *n2 = PREV(n); while( n ) { n = NEXT(n); i++; } while( n2 ) { n2 = PREV(n2); i++; } return i; }
/* * coalesce - Coalesce adjacent free blocks. Sort the new free block into the * appropriate list. */ static void *coalesce(void *ptr) { size_t prev_alloc = GET_ALLOC(HEAD(PREV(ptr))); size_t next_alloc = GET_ALLOC(HEAD(NEXT(ptr))); size_t size = GET_SIZE(HEAD(ptr)); /* Return if previous and next blocks are allocated */ if (prev_alloc && next_alloc) { return ptr; } /* Do not coalesce with previous block if it is tagged */ if (GET_TAG(HEAD(PREV(ptr)))) prev_alloc = 1; /* Remove old block from list */ delete_node(ptr); /* Detect free blocks and merge, if possible */ if (prev_alloc && !next_alloc) { delete_node(NEXT(ptr)); size += GET_SIZE(HEAD(NEXT(ptr))); PUT(HEAD(ptr), PACK(size, 0)); PUT(FOOT(ptr), PACK(size, 0)); } else if (!prev_alloc && next_alloc) { delete_node(PREV(ptr)); size += GET_SIZE(HEAD(PREV(ptr))); PUT(FOOT(ptr), PACK(size, 0)); PUT(HEAD(PREV(ptr)), PACK(size, 0)); ptr = PREV(ptr); } else { delete_node(PREV(ptr)); delete_node(NEXT(ptr)); size += GET_SIZE(HEAD(PREV(ptr))) + GET_SIZE(HEAD(NEXT(ptr))); PUT(HEAD(PREV(ptr)), PACK(size, 0)); PUT(FOOT(NEXT(ptr)), PACK(size, 0)); ptr = PREV(ptr); } /* Adjust segregated linked lists */ insert_node(ptr, size); return ptr; }
void dump() { if (root_page == NULL) { printf(" EMPTY |\n"); return; } void* prev = NULL; void* node = CONTROL_BLOCK_FIRST_NODE(root_page->ptr); void* next_hdr = NULL; kma_page_t* page = NULL; kma_page_t* prev_page = NULL; while (node != NULL) { prev_page = page; int page_id; if ((void*) BASEADDR(node) == root_page->ptr) { page = root_page; page_id = root_page->id; } else { page = *((kma_page_t**) BASEADDR(node)); page_id = (*((kma_page_t**) BASEADDR(node)))->id; } if (prev == NULL) { if (node > root_page->ptr + CONTROL_BLOCK_SIZE) { print_sequential_allocated(root_page->ptr + CONTROL_BLOCK_SIZE, &next_hdr); } } else if (prev_page != page) { print_sequential_allocated(page->ptr + CONTROL_BLOCK_SIZE, &next_hdr); } else { kma_size_t diff = node - (prev + ALLOC_HEADER_SIZE + SIZE(prev)); if (diff > 0) { print_sequential_allocated(prev + ALLOC_HEADER_SIZE + SIZE(prev), &next_hdr); } } // if (prev_page == page && next_hdr != NULL) { // assert(next_hdr == node); // } printf("%2d FREED | hdr = %11p; size %4x; next_hdr = %11p; PREV = %11p; NEXT = %11p\n", page_id, node, SIZE(node), node + ALLOC_HEADER_SIZE + SIZE(node), PREV(node), NEXT(node)); next_hdr = node + ALLOC_HEADER_SIZE + SIZE(node); prev = node; node = NEXT(node); } }
int last_List(List * list) { if (list->head_of_List) { list->current_of_List = PREV(list->head_of_List); return 1; } return 0; }
void append_List(List * list, void *item) { if (!list->head_of_List) { list->head_of_List = list->current_of_List = item; NEXT(item) = item; PREV(item) = item; } else { void *tail = PREV(list->head_of_List); NEXT(tail) = item; PREV(list->head_of_List) = item; PREV(item) = tail; NEXT(item) = list->head_of_List; } }
NCURSES_SP_NAME(getmouse) (NCURSES_SP_DCLx MEVENT * aevent) { int result = ERR; T((T_CALLED("getmouse(%p,%p)"), (void *) SP_PARM, (void *) aevent)); if ((aevent != 0) && (SP_PARM != 0) && (SP_PARM->_mouse_type != M_NONE)) { MEVENT *eventp = SP_PARM->_mouse_eventp; /* compute the current-event pointer */ MEVENT *prev = PREV(eventp); /* * Discard events not matching mask (there could be still some if * _nc_mouse_parse was not called, e.g., when _nc_mouse_inline returns * false). */ while (ValidEvent(prev) && (!(prev->bstate & SP_PARM->_mouse_mask2))) { Invalidate(prev); prev = PREV(prev); } if (ValidEvent(prev)) { /* copy the event we find there */ *aevent = *prev; TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld", _nc_tracemouse(SP_PARM, prev), (long) IndexEV(SP_PARM, prev))); Invalidate(prev); /* so the queue slot becomes free */ SP_PARM->_mouse_eventp = prev; result = OK; } else { /* Reset the provided event */ aevent->bstate = 0; Invalidate(aevent); aevent->x = 0; aevent->y = 0; aevent->z = 0; } } returnCode(result); }
static void *find_fit(size_t asize){ void *bp; bp = endfree; /*first fit search*/ while (bp != NULL) { if (!GET_ALLOC(HDRP(bp)) && (asize <= GET_SIZE(HDRP(bp)))) return bp; bp = PREV(bp); } return NULL; }
// The point at the opposite quadrilateral corner. // If it doesn't exist, reflect the given point across the edge. static point opposite(TriMesh *mesh, int f, int v) { int ind = mesh->faces[f].indexof(v); int ae = mesh->across_edge[f][ind]; if (ae) { int j = mesh->faces[ae].indexof(mesh->faces[f][NEXT(ind)]); return mesh->vertices[mesh->faces[ae][NEXT(j)]]; } return mesh->vertices[mesh->faces[f][NEXT(ind)]] + mesh->vertices[mesh->faces[f][PREV(ind)]] - mesh->vertices[v]; }
static void *coalesce(void *currblock) { size_t prev_alloc = FULL(HEADER(PREV(currblock))); size_t next_alloc = FULL(HEADER(NEXT(currblock))); size_t size = GETSIZE(HEADER(currblock)); if (prev_alloc && next_alloc) { return currblock; } if (RTAG(HEADER(PREV(currblock)))) prev_alloc = 1; deletefree(currblock); if (prev_alloc && !next_alloc) { deletefree(NEXT(currblock)); size += GETSIZE(HEADER(NEXT(currblock))); PUT(HEADER(currblock), PACK(size, 0)); PUT(FOOTER(currblock), PACK(size, 0)); } else if (!prev_alloc && next_alloc) { deletefree(PREV(currblock)); size += GETSIZE(HEADER(PREV(currblock))); PUT(FOOTER(currblock), PACK(size, 0)); PUT(HEADER(PREV(currblock)), PACK(size, 0)); currblock = PREV(currblock); } else { deletefree(PREV(currblock)); deletefree(NEXT(currblock)); size += GETSIZE(HEADER(PREV(currblock))) + GETSIZE(HEADER(NEXT(currblock))); PUT(HEADER(PREV(currblock)), PACK(size, 0)); PUT(FOOTER(NEXT(currblock)), PACK(size, 0)); currblock = PREV(currblock); } insertfree(currblock, size); return coalesce(currblock); }
void add_and_insert_free_header(void* target, kma_size_t size) { /* Set size of block */ SIZE(target) = size; void* node = CONTROL_BLOCK_FIRST_NODE(root_page->ptr); if (node == NULL) { /* If there are no blocks in the list add it like this */ CONTROL_BLOCK_FIRST_NODE(root_page->ptr) = target; PREV(target) = NULL; NEXT(target) = NULL; } else { /* Find the block that should be on either side of the newly inserted block */ void* prev = NULL; while (node < target && node != NULL) { prev = node; node = NEXT(node); } /* Add it to the linked list */ if (node != NULL) { PREV(node) = target; } if (prev == NULL) { CONTROL_BLOCK_FIRST_NODE(root_page->ptr) = target; } else { NEXT(prev) = target; } NEXT(target) = node; PREV(target) = prev; } }
/* ================== SG_ClientTrail_PickFirst ================== */ edict_t *SG_ClientTrail_PickFirst (edict_t *self){ int marker; int i; if (!trailActive) return NULL; for (marker = trailHead, i = TRAIL_LENGTH; i; i--){ if (trail[marker]->timestamp <= self->monsterinfo.trail_time) marker = NEXT(marker); else break; } if (SG_IsEntityVisible(self, trail[marker])) return trail[marker]; if (SG_IsEntityVisible(self, trail[PREV(marker)])) return trail[PREV(marker)]; return trail[marker]; }
static void txstart(Ether *edev) { int tdh, tdt, len, olen; Ctlr *ctlr = edev->ctlr; Block *bp; Tdesc *tdesc; /* * Try to fill the ring back up, moving buffers from the transmit q. */ tdh = PREV(ctlr->tdh, Ntdesc); for(tdt = ctlr->tdt; tdt != tdh; tdt = NEXT(tdt, Ntdesc)){ /* pull off the head of the transmission queue */ if((bp = ctlr->bqhead) == nil) /* was qget(edev->oq) */ break; ctlr->bqhead = bp->next; if (ctlr->bqtail == bp) ctlr->bqtail = nil; len = olen = BLEN(bp); /* * if packet is too short, make it longer rather than relying * on ethernet interface to pad it and complain so the caller * will get fixed. I don't think Psp is working right, or it's * getting cleared. */ if (len < ETHERMINTU) { if (bp->rp + ETHERMINTU <= bp->lim) bp->wp = bp->rp + ETHERMINTU; else bp->wp = bp->lim; len = BLEN(bp); print("txstart: extended short pkt %d -> %d bytes\n", olen, len); } /* set up a descriptor for it */ tdesc = &ctlr->tdba[tdt]; tdesc->addr[0] = PCIWADDR(bp->rp); tdesc->addr[1] = 0; tdesc->control = /* Ide| */ Rs|Dext|Ifcs|Teop|DtypeDD|len; tdesc->status = 0; ctlr->tb[tdt] = bp; } ctlr->tdt = tdt; csr32w(ctlr, Tdt, tdt); igbeim(ctlr, Txdw); }
bool face_plane_intersection (const Face *face, const Face *plane, Bary &b0, Bary &b1) { const Vec3 &x0 = plane->v[0]->node->x, &n = plane->n; double h[3]; int sign_sum = 0; for (int v = 0; v < 3; v++) { h[v] = dot(face->v[v]->node->x - x0, n); sign_sum += sgn(h[v]); } if (sign_sum == -3 || sign_sum == 3) return false; int v0 = -1; for (int v = 0; v < 3; v++) if (sgn(h[v]) == -sign_sum) v0 = v; double t0 = h[v0]/(h[v0] - h[NEXT(v0)]), t1 = h[v0]/(h[v0] - h[PREV(v0)]); b0[v0] = 1 - t0; b0[NEXT(v0)] = t0; b0[PREV(v0)] = 0; b1[v0] = 1 - t1; b1[PREV(v0)] = t1; b1[NEXT(v0)] = 0; return true; }
/* ================== SG_AddClientTrail ================== */ void SG_AddClientTrail (vec3_t spot){ vec3_t temp; if (!trailActive) return; VectorCopy(spot, trail[trailHead]->s.origin); trail[trailHead]->timestamp = level.time; VectorSubtract(spot, trail[PREV(trailHead)]->s.origin, temp); trail[trailHead]->s.angles[1] = SG_VectorToYaw(temp); trailHead = NEXT(trailHead); }
static void adjust(Pos p, Ori o) { /* Recalculate cross asserts and totals in the given orientation. * Find the squares adjoining the block p is part of, * find the stats at both of these squares. */ Pos left,right; for(right=p; HASLETTER(right); right = NEXT(right,o)) ; for(left=p; HASLETTER(left); left = PREV(left,o)) ; findstats(left,o); findstats(right,o); }
void PlayerTrail_Add (vec3_t spot) { vec3_t temp; if (!trail_active) return; VectorCopy (spot, trail[trail_head]->s.origin); trail[trail_head]->timestamp = level.time; VectorSubtract (spot, trail[PREV(trail_head)]->s.origin, temp); trail[trail_head]->s.angles[1] = vectoyaw (temp); trail_head = NEXT(trail_head); }