Example #1
0
/* If ice was affecting any objects correct that now
 * Also used for starting ice effects too. [zap.c]
 */
void obj_ice_effects(int x, int y, boolean do_buried)
{
	struct obj *otmp;

	for (otmp = level->objects[x][y]; otmp; otmp = otmp->nexthere) {
		if (otmp->timed) obj_timer_checks(otmp, x, y, 0);
	}
	if (do_buried) {
	    for (otmp = level->buriedobjlist; otmp; otmp = otmp->nobj) {
 		if (otmp->ox == x && otmp->oy == y) {
			if (otmp->timed) obj_timer_checks(otmp, x, y, 0);
		}
	    }
	}
}
Example #2
0
/* put the object at the given location */
void
place_object(register struct obj *otmp, int x, int y)
{
    register struct obj *otmp2 = level.objects[x][y];

    if (otmp->where != OBJ_FREE)
        panic("place_object: obj not free (%d,%d,%d)", otmp->where, otmp->otyp, otmp->invlet);

    obj_no_longer_held(otmp);
    if (otmp->otyp == BOULDER) block_point(x,y);	/* vision */

    /* obj goes under boulders */
    if (otmp2 && (otmp2->otyp == BOULDER)) {
        otmp->nexthere = otmp2->nexthere;
        otmp2->nexthere = otmp;
    } else {
        otmp->nexthere = otmp2;
        level.objects[x][y] = otmp;
    }

    /* set the new object's location */
    otmp->ox = x;
    otmp->oy = y;

    otmp->where = OBJ_FLOOR;

    /* add to floor chain */
    otmp->nobj = fobj;
    fobj = otmp;
    if (otmp->timed) obj_timer_checks(otmp, x, y, 0);
}
Example #3
0
/* put the object at the given location */
void place_object(struct obj *otmp, struct level *lev, int x, int y)
{
    struct obj *otmp2 = lev->objects[x][y];

    if (otmp->where != OBJ_FREE)
	panic("place_object: obj not free");

    obj_no_longer_held(otmp);
    if (otmp->otyp == BOULDER) block_point(x,y);	/* vision */

    /* obj goes under boulders */
    if (otmp2 && (otmp2->otyp == BOULDER)) {
	otmp->nexthere = otmp2->nexthere;
	otmp2->nexthere = otmp;
    } else {
	otmp->nexthere = otmp2;
	lev->objects[x][y] = otmp;
    }

    /* set the new object's location */
    otmp->ox = x;
    otmp->oy = y;

    otmp->where = OBJ_FLOOR;
    set_obj_level(lev, otmp); /* set the level recursively for containers */

    /* add to floor chain */
    otmp->nobj = lev->objlist;
    lev->objlist = otmp;
    if (otmp->timed) obj_timer_checks(otmp, x, y, 0);
}
Example #4
0
void remove_object(struct obj *otmp)
{
    xchar x = otmp->ox;
    xchar y = otmp->oy;

    if (otmp->where != OBJ_FLOOR)
	panic("remove_object: obj not on floor");
    if (otmp->otyp == BOULDER) unblock_point(x,y); /* vision */
    extract_nexthere(otmp, &otmp->olev->objects[x][y]);
    extract_nobj(otmp, &otmp->olev->objlist);
    if (otmp->timed) obj_timer_checks(otmp,x,y,0);
}