Beispiel #1
0
/*
=============
Undo_AddBrush
=============
*/
void Undo_AddBrush(brush_t *pBrush)
{
	if (!g_lastundo)
	{
		Sys_Status("Undo_AddBrushList: no last undo.\n");
		return;
	}
	if (g_lastundo->entitylist.next != &g_lastundo->entitylist)
	{
		Sys_Status("Undo_AddBrushList: WARNING adding brushes after entity.\n");
	}
	//if the brush is already in the undo
	if (Undo_BrushInUndo(g_lastundo, pBrush))
		return;
	//clone the brush
	brush_t* pClone = Brush_FullClone(pBrush);
	//save the ID of the owner entity
	pClone->ownerId = pBrush->owner->entityId;

	if (pBrush->owner && !(pBrush->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN)) {
		Undo_AddEntity(pBrush->owner);
	}

	//save the old undo ID for previous undos
	pClone->undoId = pBrush->undoId;
	Brush_AddToList (pClone, &g_lastundo->brushlist);
	//
	g_undoMemorySize += Brush_MemorySize(pClone);
}
Beispiel #2
0
/*
=============
Undo_AddBrush
=============
*/
void Undo_AddBrush(brush_t *pBrush)
{
	// spog - disable undo if undo levels = 0
	if (g_PrefsDlg.m_nUndoLevels == 0)
	{
#ifdef DBG_UNDO
		Sys_Printf("Undo_AddBrush: undo is disabled.\n");
#endif
		return;
	}

	if (!g_lastundo)
	{
		Sys_Printf("Undo_AddBrushList: no last undo.\n");
		return;
	}
	if (g_lastundo->entitylist.next != &g_lastundo->entitylist)
	{
		Sys_Printf("Undo_AddBrushList: WARNING adding brushes after entity.\n");
	}
	//if the brush is already in the undo
	if (Undo_BrushInUndo(g_lastundo, pBrush))
		return;
	//clone the brush
	brush_t* pClone = Brush_FullClone(pBrush);
	//save the ID of the owner entity
	pClone->ownerId = pBrush->owner->entityId;
	//save the old undo ID for previous undos
	pClone->undoId = pBrush->undoId;
	Brush_AddToList (pClone, &g_lastundo->brushlist);
	//
	g_undoMemorySize += Brush_MemorySize(pClone);
}
Beispiel #3
0
/*
=============
Undo_AddBrushList
TTimo: some brushes are just there for UI, and the information is somewhere else
for patches it's in the patchMesh_t structure, so when we clone the brush we get that information (brush_t::pPatch)
but: models are stored in pBrush->owner->md3Class, and owner epairs and origin parameters are important
  so, we detect models and push the entity in the undo session (as well as it's BBox brush)
	same for other items like weapons and ammo etc.
=============
*/
void Undo_AddBrushList(brush_t *brushlist)
{
	// spog - disable undo if undo levels = 0
	if (g_PrefsDlg.m_nUndoLevels == 0)
	{
#ifdef DBG_UNDO
		Sys_Printf("Undo_AddBrushList: undo is disabled.\n");
#endif
		return;
	}

	brush_t *pBrush;

	if (!g_lastundo)
	{
		Sys_Printf("Undo_AddBrushList: no last undo.\n");
		return;
	}
	if (g_lastundo->entitylist.next != &g_lastundo->entitylist)
	{
		Sys_Printf("Undo_AddBrushList: WARNING adding brushes after entity.\n");
	}
	//copy the brushes to the undo
	for (pBrush = brushlist->next ; pBrush != NULL && pBrush != brushlist; pBrush=pBrush->next)
	{
		//if the brush is already in the undo
		//++timo FIXME: when does this happen?
		if (Undo_BrushInUndo(g_lastundo, pBrush))
			continue;
		// do we need to store this brush's entity in the undo?
		// if it's a fixed size entity, the brush that reprents it is not really relevant, it's used for selecting and moving around
		// what we want to store for undo is the owner entity, epairs and origin/angle stuff
		//++timo FIXME: if the entity is not fixed size I don't know, so I don't do it yet
		if (pBrush->owner->eclass->fixedsize == 1)
			Undo_AddEntity( pBrush->owner );
		// clone the brush
		brush_t* pClone = Brush_FullClone(pBrush);
		// save the ID of the owner entity
		pClone->ownerId = pBrush->owner->entityId;
		// save the old undo ID from previous undos
		pClone->undoId = pBrush->undoId;
		Brush_AddToList (pClone, &g_lastundo->brushlist);
		// track memory size used by undo
		g_undoMemorySize += Brush_MemorySize(pClone);
	}
}
Beispiel #4
0
/*
=============
Undo_AddBrushList
=============
*/
void Undo_AddBrushList(brush_t *brushlist)
{
	brush_t *pBrush;

	if (!g_lastundo)
	{
		Sys_Status("Undo_AddBrushList: no last undo.\n");
		return;
	}
	if (g_lastundo->entitylist.next != &g_lastundo->entitylist)
	{
		Sys_Status("Undo_AddBrushList: WARNING adding brushes after entity.\n");
	}
	//copy the brushes to the undo
	for (pBrush = brushlist->next ; pBrush != NULL && pBrush != brushlist; pBrush=pBrush->next)
	{
		//if the brush is already in the undo
		if (Undo_BrushInUndo(g_lastundo, pBrush))
			continue;
		//clone the brush
		brush_t* pClone = Brush_FullClone(pBrush);
		//save the ID of the owner entity
		pClone->ownerId = pBrush->owner->entityId;
		//save the old undo ID from previous undos
		pClone->undoId = pBrush->undoId;

		if ( pBrush->owner && pBrush->owner != world_entity ) {
			Undo_AddEntity(pBrush->owner);
		}


		Brush_AddToList (pClone, &g_lastundo->brushlist);
		//
		g_undoMemorySize += Brush_MemorySize(pClone);
	}
}