Annotation of 43BSDReno/games/warp/object.c, revision 1.1

1.1     ! root        1: /* $Header: object.c,v 7.0 86/10/08 15:12:55 lwall Exp $ */
        !             2: 
        !             3: /* $Log:       object.c,v $
        !             4:  * Revision 7.0  86/10/08  15:12:55  lwall
        !             5:  * Split into separate files.  Added amoebas and pirates.
        !             6:  * 
        !             7:  */
        !             8: 
        !             9: #include "EXTERN.h"
        !            10: #include "warp.h"
        !            11: #include "INTERN.h"
        !            12: #include "object.h"
        !            13: 
        !            14: void
        !            15: object_init()
        !            16: {
        !            17:     ;
        !            18: }
        !            19: 
        !            20: OBJECT *
        !            21: make_object(typ, img, py, px, vy, vx, energ, mas, where)
        !            22: char typ;
        !            23: char img;
        !            24: int px, py, vx, vy;
        !            25: long energ, mas;
        !            26: OBJECT *where;
        !            27: {
        !            28:     Reg1 OBJECT *obj;
        !            29: 
        !            30:     if (free_root.next == &free_root)
        !            31: #ifndef lint
        !            32:        obj = (OBJECT *) malloc(sizeof root);
        !            33: #else
        !            34:        obj = Null(OBJECT*);
        !            35: #endif
        !            36:     else {
        !            37:        obj = free_root.next;
        !            38:        free_root.next = obj->next;
        !            39:        obj->next->prev = &free_root;
        !            40:     }
        !            41:     obj->type = typ;
        !            42:     obj->image = img;
        !            43:     obj->next = where;
        !            44:     obj->prev = where->prev;
        !            45:     where->prev = obj;
        !            46:     obj->prev->next = obj;
        !            47:     obj->velx = vx;
        !            48:     obj->vely = vy;
        !            49:     obj->contend = 0;
        !            50:     obj->strategy = 0;
        !            51:     obj->flags = 0;
        !            52:     obj->posx = px;
        !            53:     obj->posy = py;
        !            54:     if (typ != Torp && typ != Web) {
        !            55:        occupant[py][px] = obj;
        !            56:     }
        !            57:     obj->energy = energ;
        !            58:     obj->mass = mas;
        !            59:     return(obj);
        !            60: }
        !            61: 
        !            62: void
        !            63: unmake_object(curobj)
        !            64: Reg1 OBJECT *curobj;
        !            65: {
        !            66:     curobj->prev->next = curobj->next;
        !            67:     curobj->next->prev = curobj->prev;
        !            68:     if (curobj == movers) {
        !            69:        movers = curobj->next;
        !            70:     }
        !            71:     free_object(curobj);
        !            72: }
        !            73: 
        !            74: void
        !            75: free_object(curobj)
        !            76: Reg1 OBJECT *curobj;
        !            77: {
        !            78:     curobj->next = free_root.next;
        !            79:     curobj->prev = &free_root;
        !            80:     free_root.next->prev = curobj;
        !            81:     free_root.next = curobj;
        !            82: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.