Exemple #1
0
void camera::set(cameraPos position, bool t){
	copyStruct(&position, &toPos);
	if (framesLeft <= 0) {
		copyStruct(&position, &currentPos);
	}
	changed = true;
	if (t) touch();
}
int main (int argc, const char * argv[]) {
    MiniStruct inny;
    MiniStruct outty;
    MiniStruct (^copyStruct)(MiniStruct);
    
    memset(&inny, 0xA5, sizeof(inny));
    memset(&outty, 0x2A, sizeof(outty));    
    
    inny.a = 12;
    inny.b = 42;

    copyStruct = ^(MiniStruct aTinyStruct){ return aTinyStruct; };  // pass-by-value intrinsically copies the argument
    
    outty = copyStruct(inny);

    if ( &inny == &outty ) {
        printf("%s: struct wasn't copied.", argv[0]);
        exit(1);
    }
    if ( (inny.a != outty.a) || (inny.b != outty.b) ) {
        printf("%s: struct contents did not match.", argv[0]);
        exit(1);
    }
    
    printf("%s: success\n", argv[0]);
    return 0;
}
Exemple #3
0
EERIE_3DOBJ * Eerie_Copy(const EERIE_3DOBJ * obj) {
	
	EERIE_3DOBJ * nouvo = new EERIE_3DOBJ(); 
	
	nouvo->vertexlist = obj->vertexlist;
	
	nouvo->vertexlist3 = obj->vertexlist3;
	
	nouvo->ndata = NULL;
	nouvo->pbox = NULL;
	nouvo->pdata = NULL;
	nouvo->cdata = NULL;
	nouvo->sdata = NULL;
	nouvo->m_skeleton = NULL;
	nouvo->vertexlocal = NULL;
	
	nouvo->angle = obj->angle;
	nouvo->pos = obj->pos;
	nouvo->cub.xmax = obj->cub.xmax;
	nouvo->cub.xmin = obj->cub.xmin;
	nouvo->cub.ymax = obj->cub.ymax;
	nouvo->cub.ymin = obj->cub.ymin;
	nouvo->cub.zmax = obj->cub.zmax;
	nouvo->cub.zmin = obj->cub.zmin;
	
	if(!obj->file.empty())
		nouvo->file = obj->file;
	
	if(!obj->name.empty())
		nouvo->name = obj->name;

	nouvo->origin = obj->origin;
	nouvo->point0 = obj->point0;
	nouvo->quat = obj->quat;


	if(obj->ndata)
		nouvo->ndata = copyStruct(obj->ndata, obj->vertexlist.size());
	else
		nouvo->ndata = NULL;

	nouvo->facelist = obj->facelist;
	nouvo->grouplist = obj->grouplist;
	nouvo->actionlist = obj->actionlist;
	nouvo->selections = obj->selections;
	nouvo->texturecontainer = obj->texturecontainer;
	nouvo->fastaccess = obj->fastaccess;
	
	EERIE_CreateCedricData(nouvo);

	if(obj->pbox) {
		nouvo->pbox = new PHYSICS_BOX_DATA();
		nouvo->pbox->nb_physvert = obj->pbox->nb_physvert;
		nouvo->pbox->stopcount = 0;
		nouvo->pbox->radius = obj->pbox->radius;
		
		nouvo->pbox->vert = copyStruct(obj->pbox->vert, obj->pbox->nb_physvert);
	}
	
	nouvo->linked.clear();
	nouvo->originaltextures = NULL;
	return nouvo;
}
Exemple #4
0
void camera::animate(int frames){
	framesLeft = frames;
	framesAnimate = frames;
	copyStruct(&currentPos, &fromPos);
}