Exemple #1
0
//=====================================================================================
//	geCamera_Create
//=====================================================================================
GENESISAPI geCamera *GENESISCC geCamera_Create(geFloat Fov, const geRect *Rect)
{
	geCamera *Camera;

	assert( Rect != NULL );

	Camera = GE_RAM_ALLOCATE_STRUCT(geCamera);
	if (Camera == NULL)
		{
			geErrorLog_Add(-1, NULL); //FIXME
			return NULL;
		}

	memset(Camera, 0, sizeof(geCamera));

	Camera->ZScale = 0.5f;

#if 0
	Camera->ZFar = 1000.0f;
	Camera->ZFarEnable = GE_TRUE;
#endif

	geCamera_SetAttributes(Camera,Fov,Rect);
	return Camera;
}
Exemple #2
0
//=====================================================================================
//	geSound_SystemCreate
//=====================================================================================
GENESISAPI	geSound_System *geSound_CreateSoundSystem(HWND hWnd)
{
	geSound_System		*SoundSystem;

	SoundSystem = GE_RAM_ALLOCATE_STRUCT(geSound_System);

	if (!SoundSystem)
	{
		geErrorLog_Add(GE_ERR_OUT_OF_MEMORY, NULL);
		return NULL;
	}

	memset(SoundSystem, 0, sizeof(geSound_System));
	
	// Initialize the sound system
	SoundSystem->SoundM = CreateSoundManager(hWnd);

	if (!SoundSystem->SoundM)
	{
		geRam_Free(SoundSystem);
		geErrorLog_Add(GE_ERR_CREATE_SOUND_MANAGER_FAILED, NULL);
		return NULL;
	}
	SoundSystem->GlobalVolume = 1.0f;

	return SoundSystem;
}
FmtActor_Options* FmtActor_OptionsCreate()
{
    FmtActor_Options* pOptions;

    pOptions = GE_RAM_ALLOCATE_STRUCT(FmtActor_Options);
    if(pOptions != NULL)
    {
        *pOptions = DefaultOptions;
    }

    return pOptions;
}
AOptions *AOptions_Create (void)
{
	AOptions *Options = GE_RAM_ALLOCATE_STRUCT (AOptions);
	if (Options != NULL)
	{
		strcpy (Options->ViewerPath, "c:\\Program Files\\Eclipse\\Genesis3D\\ActView.exe");
		strcpy (Options->MaxPath, "c:\\3dsmax2\\3dsmax.exe");
		Options->OptFlag = GE_TRUE;
		Options->OptLevel = 4;
	}
	return Options;
}
Exemple #5
0
//=====================================================================================
//	geWorld_AddPoly
//=====================================================================================
GENESISAPI gePoly *geWorld_AddPoly(		geWorld *World, 
										GE_LVertex *Verts, 
										int32 NumVerts, 
										geBitmap *Bitmap,
										gePoly_Type Type, 
										uint32 RenderFlags,
										geFloat Scale)
{
	gePoly		*Poly;

	assert(World != NULL);
	assert(World->UserInfo != NULL);

	assert(Bitmap != NULL || Type == GE_GOURAUD_POLY);
	assert(Verts != NULL);
	assert(NumVerts <= MAX_USER_VERTS);
	
	Poly = GE_RAM_ALLOCATE_STRUCT(gePoly);

	if (!Poly)
		return NULL;

	if ( World->CurrentBSP )
		gGFXModels = World->CurrentBSP->BSPData.GFXModels;
	else
		gGFXModels = NULL;

#ifdef _DEBUG
	Poly->Self1 = Poly;
	Poly->Self2 = Poly;
#endif

	Poly->NumVerts = NumVerts;
	Poly->Bitmap = Bitmap;
	Poly->Type = Type;
	Poly->RenderFlags = RenderFlags;
	Poly->Scale = Scale;
	Poly->World = World;		// I could think of no other way!!!  Poly needs world in SetLVertex.  Should we require it as a parm???
	Poly->AddOnceNext = NULL;
	Poly->Next = NULL;
	Poly->Prev = NULL;
	Poly->LeafData = NULL;

	memcpy(Poly->Verts, Verts, sizeof(GE_LVertex)*NumVerts);

	// Link the poly to the leaf it is in
	geWorld_LinkPolyToLeaf(World, Poly);

	World->ActiveUserPolys++;

	return Poly;
}
/* ------------------------------------------------------------------------------------ */
ActorParticle_System*  ActorParticle_SystemCreate()
{
	ActorParticle_System *ps;

	ps = GE_RAM_ALLOCATE_STRUCT(ActorParticle_System);

	if(!ps)
		return ps;

	memset(ps, 0, sizeof(*ps));

	ps->psQuantumSeconds = QUANTUMSIZE;
	ps->psLastTime = 0.0f;

	return ps;
}
//=====================================================================================
//	AllocPortal
//=====================================================================================
GBSP_Portal *AllocPortal(void)
{
	GBSP_Portal	*NewPortal;

	NewPortal = GE_RAM_ALLOCATE_STRUCT(GBSP_Portal);

	if (!NewPortal)
	{
		GHook.Error("AllocPortal:  Out of memory!\n");
		return NULL;
	}

	memset(NewPortal, 0, sizeof(GBSP_Portal));

	return NewPortal;
}
/* ------------------------------------------------------------------------------------ */
Particle_System* Particle_SystemCreate(geWorld *World)
{
	Particle_System *ps;

	ps = GE_RAM_ALLOCATE_STRUCT(Particle_System);
	if	(!ps)
		return ps;

	memset(ps, 0, sizeof(*ps));

	ps->psWorld	= World;
	ps->psQuantumSeconds = QUANTUMSIZE;
	ps->psLastTime = 0.0f;

	return ps;
}
MkActor_Options* MkActor_OptionsCreate()
{
	MkActor_Options* pOptions;

	pOptions = GE_RAM_ALLOCATE_STRUCT(MkActor_Options);
	if(pOptions != NULL)
	{
		*pOptions = DefaultOptions;

		pOptions->pMotionFileBlock = geStrBlock_Create();
		if(pOptions->pMotionFileBlock == NULL)
		{
			geRam_Free(pOptions);
		}
	}

	return pOptions;
}
/* ------------------------------------------------------------------------------------ */
void CLogic::SetState()
{
	geEntity_EntitySet *pSet;
	geEntity *pEntity;
	LState *pool;

	Bottom = (LState *)NULL;

	if(Count == 0)
		return;						// Don't waste CPU cycles

	// Ok, check to see if there are logic gates in this world
	pSet = geWorld_GetEntitySet(CCD->World(), "LogicGate");

	if(!pSet)
		return;									// No LogicGates

	// Ok, we have logic gates somewhere.  Dig through 'em all.
	for(pEntity=geEntity_EntitySetGetNextEntity(pSet, NULL); pEntity;
		pEntity=geEntity_EntitySetGetNextEntity(pSet, pEntity))
	{
		LogicGate *pSource = (LogicGate*)geEntity_GetUserData(pEntity);

		if(EffectC_IsStringNull(pSource->szEntityName))
		{
			char szName[128];
			geEntity_GetName(pEntity, szName, 128);
			pSource->szEntityName = szName;
		}

		pool = GE_RAM_ALLOCATE_STRUCT(LState);
		memset(pool, 0xcc, sizeof(LState));
		pool->next = Bottom;
		Bottom = pool;

		if(pool->next)
			pool->next->prev = pool;

		pool->Name = strdup(pSource->szEntityName);
		pool->state = pSource->bState;
	}

	return;
}
static BOOL TPack_InitializeDialog (HWND hwnd)
{
	TPack_WindowData *	pData;
	HFONT				Font;
	HWND				ListWnd;

	// allocate window local data structure
	pData = GE_RAM_ALLOCATE_STRUCT (TPack_WindowData);
	if (pData == NULL)
	{
		DestroyWindow (hwnd);
		return TRUE;
	}

	// and initialize it
	pData->Instance		 = (HINSTANCE)GetWindowLong (hwnd, GWL_HINSTANCE);
	pData->hwnd			 = hwnd;
	pData->BitmapCount	 = 0;
	pData->Bitmaps		 = NULL;
	pData->SelectedEntry = NULL;
	pData->FileNameIsValid = FALSE;
	pData->Dirty		 = FALSE;
	// Set the window data pointer in the GWL_USERDATA field
	SetWindowLong(hwnd, GWL_USERDATA, (LONG)pData);
	SetWindowLong(GetDlgItem(hwnd, IDC_PREVIEW), GWL_USERDATA, (LONG)pData);
	SetWindowLong(GetDlgItem(hwnd, IDC_PREVIEW), GWL_WNDPROC, (LONG)TPack_PreviewWndProc);

	ListWnd = GetDlgItem(hwnd, IDC_TEXTURELIST);
	SetWindowLong(ListWnd, GWL_USERDATA, (LONG)GetWindowLong(ListWnd, GWL_WNDPROC));
	SetWindowLong(ListWnd, GWL_WNDPROC, (LONG)TPack_ListBoxWndProc);
	
	Font = CreateFont( -24,
    					    0,0,0, 0,
    					    0,0,0,0,OUT_TT_ONLY_PRECIS ,0,0,0, "Arial Black");
    SendDlgItemMessage(hwnd, IDC_TEXTURESIZE, WM_SETFONT, (WPARAM)Font, MAKELPARAM(TRUE, 0));

	// set the program icon on the dialog window
	SendMessage (hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon (pData->Instance, MAKEINTRESOURCE (IDI_MAINICON)));

	DragAcceptFiles (hwnd, TRUE);

	return TRUE;
}
Exemple #12
0
//=====================================================================================
//	User_EngineInit
//=====================================================================================
geBoolean User_EngineInit(geEngine *Engine)
{
	User_Info		*Info;

	assert(Engine->UserInfo == NULL);

	Info = GE_RAM_ALLOCATE_STRUCT(User_Info);

	if (!Info)
	{
		geErrorLog_Add(GE_ERR_OUT_OF_MEMORY, NULL);
		return GE_FALSE;;
	}

	memset(Info, 0, sizeof(User_Info));

	Engine->UserInfo = Info;

	return GE_TRUE;
}
/* ------------------------------------------------------------------------------------ */
static Particle* CreateParticle(Particle_System *ps, geBitmap *Texture, const GE_LVertex *Vert)
{
	Particle *ptcl;

	ptcl = GE_RAM_ALLOCATE_STRUCT(Particle);

	if(!ptcl)
		return ptcl;

	memset(ptcl, 0, sizeof(*ptcl));

	ptcl->ptclNext = ps->psParticles;
	ps->psParticles = ptcl;

	if(ptcl->ptclNext)
	  ptcl->ptclNext->ptclPrev = ptcl;

	ptcl->ptclTexture = Texture;
	ptcl->ptclVertex = *Vert;

	return ptcl;
}
Exemple #14
0
//=====================================================================================
//	User_WorldInit
//=====================================================================================
geBoolean User_WorldInit(geWorld *World)
{
	User_Info			*Info;

	assert(World != NULL);

	Info = GE_RAM_ALLOCATE_STRUCT(User_Info);
	
	assert(Info != NULL);

	if (!Info)
	{
		geErrorLog_Add(GE_ERR_OUT_OF_MEMORY, NULL);
		return GE_FALSE;
	}

	memset(Info, 0, sizeof(User_Info));

	World->UserInfo = Info;

	return GE_TRUE;	
}
/* ------------------------------------------------------------------------------------ */
static ActorParticle* ActorCreateParticle(ActorParticle_System *ps,
										  char *ActorName,
										  geVec3d Position,
										  geVec3d BaseRotation)
{
	ActorParticle *ptcl;

	ptcl = GE_RAM_ALLOCATE_STRUCT(ActorParticle);

	if(!ptcl)
		return ptcl;

	memset(ptcl, 0, sizeof(*ptcl));

	ptcl->ptclNext = ps->psParticles;
	ps->psParticles = ptcl;

	if(ptcl->ptclNext)
	  ptcl->ptclNext->ptclPrev = ptcl;

	ptcl->Actor = CCD->ActorManager()->SpawnActor(ActorName, Position, BaseRotation, "", "", NULL);

	return ptcl;
}
// Create empty project
AProject *AProject_Create (const char *OutputName)
{
	AProject *pProject;
	geBoolean NoErrors;
	char OutputNameAndExt[MAX_PATH];

	assert (OutputName != NULL);

	pProject = GE_RAM_ALLOCATE_STRUCT (AProject);
	if (pProject == NULL)
	{
		geErrorLog_AddString (GE_ERR_MEMORY_RESOURCE, "Allocating project structure",NULL);
		return NULL;
	}

	// Initialize defaults
	// Output
	pProject->Output.Filename = NULL;
	pProject->Output.Fmt = ApjOutput_Binary;

	// Paths
	pProject->Paths.ForceRelative = GE_TRUE;
	pProject->Paths.Materials = NULL;

	// Body
	pProject->Body.Filename = NULL;
	pProject->Body.Fmt = ApjBody_Max;

	// Materials
	pProject->Materials.Count = 0;
	pProject->Materials.Items = NULL;

	// Motions
	pProject->Motions.Count = 0;
	pProject->Motions.Items = NULL;

	FilePath_SetExt (OutputName, ".act", OutputNameAndExt);

	// Allocate required memory
	NoErrors = 
		((pProject->Output.Filename = Util_Strdup (OutputNameAndExt)) != NULL) &&
		((pProject->Paths.Materials = Util_Strdup ("")) != NULL) &&
		((pProject->Paths.TempFiles = Util_Strdup (".\\BldTemp")) != NULL) &&
		((pProject->Body.Filename	= Util_Strdup ("")) != NULL);
		
	// Build motion and material arrays.  Initially empty.
	NoErrors = NoErrors &&
		((pProject->Materials.Items = Array_Create (1, sizeof (ApjMaterialEntry))) != NULL);

	NoErrors = NoErrors &&
		((pProject->Motions.Items = Array_Create (1, sizeof (ApjMotionEntry))) != NULL);

	// if unsuccessful, destroy any allocated data
	if (!NoErrors)
	{
		geErrorLog_AddString (GE_ERR_MEMORY_RESOURCE, "Initializing project structure",NULL);
		if (pProject != NULL)
		{
			AProject_Destroy (&pProject);
		}
	}

	return pProject;
}
Exemple #17
0
GENESISAPI gePhysicsJoint * GENESISCC gePhysicsJoint_Create(gePhysicsJoint_Kind Kind, const geVec3d *Location, 
	geFloat assemblyRate, gePhysicsObject *PS1, gePhysicsObject *PS2, geFloat physicsScale)
{
	gePhysicsJoint*	pPhysjnt;
	geVec3d		POLocation;
	geVec3d		physicsSpaceLocation;

	pPhysjnt = NULL;
	pPhysjnt = GE_RAM_ALLOCATE_STRUCT(gePhysicsJoint);
	if (pPhysjnt == NULL)
	{
		return NULL;
	}

	////////////////////////////////////////////////////////////////////////////////////////////////////
	// make sure the joint makes sense

	pPhysjnt->Type = Kind;
	pPhysjnt->assemblyRate = assemblyRate * JOINT_ASSEMBLY_RATE_MULTIPLIER;
	pPhysjnt->Object1 = PS1;
	pPhysjnt->Object2 = PS2;

	geVec3d_Scale(Location, physicsScale, &physicsSpaceLocation);

	switch (Kind)
	{
		case JT_WORLD:
			if (PS1 == NULL)
			{
				/*
				GenVSI_Error(VSI, 
					GE_FALSE, 
					"Joint_Spawn: World joint needs non-NULL gePhysicsObject1 field.\n");
				*/
				return NULL;
			}
			#if 0
			if (pJoint->Next == pJoint)
			{
				/*
				GenVSI_Error(VSI, 
					GE_FALSE, 
					"Joint_Spawn: Next field points to parent.\n");
				*/
				return NULL;
			}
			#endif
			
			gePhysicsObject_GetLocation(PS1, &POLocation, 0);

			geVec3d_Subtract(&physicsSpaceLocation,
				&POLocation,
				&pPhysjnt->locationA);
			geVec3d_Copy(&physicsSpaceLocation, &pPhysjnt->locationB);
			break;

		case JT_SPHERICAL:
			if (PS1 == NULL || PS2 == NULL)
			{
				/*
				GenVSI_Error(VSI, 
					GE_FALSE, 
					"Joint_Spawn: Spherical joint needs 2 non-NULL gePhysicsObjects.\n");
				*/
				return NULL;
			}
			#if 0
			if (pJoint->Next == pJoint)
			{
				/*
				GenVSI_Error(VSI, 
					GE_FALSE, 
					"Joint_Spawn: Next field points to parent.\n");
				*/
			}
			#endif
			if (PS1 == PS2)
			{
				/*
				GenVSI_Error(VSI, 
					GE_FALSE, 
					"Joint_Spawn: Spherical joint: need 2 distinct gePhysicsObjects.\n");
				*/
				return NULL;
			}

			gePhysicsObject_GetLocation(PS1, &POLocation, 0);
			geVec3d_Subtract(&physicsSpaceLocation,
				&POLocation,
				&pPhysjnt->locationA);

			gePhysicsObject_GetLocation(PS2, &POLocation, 0);
			geVec3d_Subtract(&physicsSpaceLocation,
				&POLocation,
				&pPhysjnt->locationB);
			break;

		default:
			/*
			GenVSI_Error(VSI, 
				GE_FALSE, 
				"Joint_Spawn: unsupported joint type %d.\n", ij->jointType);
			*/
			return NULL;
	}

	return pPhysjnt;
}
/* ------------------------------------------------------------------------------------ */
Procedural* Particles_Create(char *TextureName, geWorld *World, const char *InputParams)
{
    Procedural *Proc;
    int i;
    char ParamWork[8192],*pstr;
    geBitmap	*ppBitmap;

	Proc = GE_RAM_ALLOCATE_STRUCT(Procedural);

	if(!Proc)
		return (Procedural*)NULL;

	memset(Proc, 0, sizeof(Procedural));

	ppBitmap = geWorld_GetBitmapByName(World, TextureName);

	/**** read Params *****/

// changed RF064 by QD
	if(!strcmp(InputParams, "Params_Oil"))
	{
		strcpy(ParamWork, Params_Oil);
	}
	else if(!strcmp(InputParams, "Params_Jet"))
	{
		strcpy(ParamWork,Params_Jet);
	}
	else if(!strcmp(InputParams, "Params_Steam"))
	{
		strcpy(ParamWork,Params_Steam);
	}
	else if(!strcmp(InputParams, "Params_Explosion") || strlen(InputParams) < 20 )
	{
		strcpy(ParamWork,DefaultParams);
	}
// end change RF064 by QD
	else
	{
		strcpy(ParamWork,InputParams);
	}

	pstr = strtok(ParamWork,strbreakers);

	Proc->NumParticles = getint(pstr);
	Proc->NumSources = getint(pstr);

	/**** make Bitmap *****/

	if(!Particles_InitBitmap(ppBitmap))
		goto fail;

	Proc->Bitmap = ppBitmap;

	Proc->SizeX  = geBitmap_Width(Proc->Bitmap);
	Proc->SizeY = geBitmap_Height(Proc->Bitmap);
	geBitmap_GetInfo(Proc->Bitmap, &(Proc->BmInfo), (geBitmap_Info*)NULL);
	Proc->SizeZ = min(Proc->SizeX, Proc->SizeY);

	/**** make Particles *****/

	Proc->Particles = (Particle*)geRam_AllocateClear(Proc->NumParticles * sizeof(Particle));

	if(!(Proc->Particles))
		goto fail;

	for(i=0; i<Proc->NumParticles; i++)
	{
		Proc->Particles[i].shade = -1;
	}

	Proc->NumActiveParticles = 0;

	/**** make Sources *****/

	Proc->Sources = (ParticleSource*)geRam_AllocateClear(Proc->NumSources * sizeof(ParticleSource));

	if(!(Proc->Sources))
		goto fail;

	/**** More Params *****/

	// <> for stock schemes, take a few colors as parameters

	if(matchstr(pstr, "oil"))
	{
		nextparam(pstr);
		Proc->NumColors = Proc->NumShades = 16;
		Proc->PixelRGBA = PixelRGBA_OilColor;
	}
	else if(matchstr(pstr, "fire"))
	{
		nextparam(pstr);
		Proc->NumColors = 1;
		Proc->NumShades = 256;
		Proc->PixelRGBA = PixelRGBA_FireColor;
	}
	else if(matchstr(pstr, "opaquefire"))
	{
		nextparam(pstr);
		Proc->NumColors = 1;
		Proc->NumShades = 256;
		Proc->PixelRGBA = PixelRGBA_OpaqueFireColor;
	}
	else if(matchstr(pstr, "steam"))
	{
		nextparam(pstr);
		Proc->NumColors = 1;
		Proc->NumShades = 256;
		Proc->PixelRGBA = PixelRGBA_SteamColor;
	}
	else
	{
		Proc->NumColors = getint(pstr);
		Proc->NumShades = getint(pstr);
		Proc->PixelRGBA = PixelRGBA_OilColor;
		// <>
		// way to read in general spline of colors ?
	}

	if((Proc->NumColors * Proc->NumShades) < 256)
	{
		Proc->NumColors = min(Proc->NumColors, 256);
		Proc->NumShades = 256 / Proc->NumColors;
	}

	Proc->NumSmoothes	= getint(pstr);
	Proc->SmoothRadius	= getint(pstr);

	if(matchstr(pstr, "bounce"))
	{
		Proc->Capper = Capper_Bounce;
		Proc->SmoothWrap = GE_FALSE;
	}
	else if(matchstr(pstr,"wrap"))
	{
		Proc->Capper = Capper_Wrap;
		Proc->SmoothWrap = GE_TRUE;
	}
	else if(matchstr(pstr,"hard"))
	{
		Proc->Capper = Capper_Hard;
		Proc->SmoothWrap = GE_FALSE;
	}
	else
	{
		goto fail;
	}

	nextparam(pstr);

	Proc->DoMagnetic = getbool(pstr);

	if(Proc->DoMagnetic)
	{
		getvec(pstr, &(Proc->MagneticField));
	}

	Proc->DoAttractor = getbool(pstr);

	if(Proc->DoAttractor)
	{
		Proc->AttractorStrength = getfloat(pstr); // negative for repulsive
		Proc->AttractorIsAxis = getbool(pstr);

		if(Proc->AttractorIsAxis)
		{
			getvec(pstr, &(Proc->AttractorAxis));
			geVec3d_Normalize(&(Proc->AttractorAxis));
		}

		getvec(pstr, &(Proc->AttractorPos));
		scalevec(&(Proc->AttractorPos));
	}

	/**** LUT's *****/

	if(!Particles_InitPalette(Proc))
		goto fail;

	for(i=0; i<Proc->NumSources; i++)
	{
		ParticleSource *pSource;
		Particle *pParticle;

		pSource = Proc->Sources + i;

		// base
		pParticle = &(pSource->Base);

		getvec(pstr, pParticle->p);
		getvec(pstr, pParticle->v);

		scalevec(pParticle->p);
		scalevec(pParticle->v);

		pParticle->DeathTime = getfloat(pstr);
		pParticle->color = getint(pstr);
		pParticle->shade = Proc->NumShades - 1;
		pParticle->CurDeathTime = 0.0f;

		// random
		pParticle = &(pSource->Random);

		getvec(pstr,pParticle->p);
		getvec(pstr,pParticle->v);

		scalevec(pParticle->p);
		scalevec(pParticle->v);

		absvec(pParticle->p);
		absvec(pParticle->v);

		pParticle->DeathTime = getfloat(pstr);
		pParticle->color = getint(pstr);
		pParticle->shade = getint(pstr);
		pParticle->CurDeathTime = 0.0f;

		pSource->RandomVMagnitude = geVec3d_Normalize((geVec3d*)(pParticle->v));

		pSource->Delay = getfloat(pstr); // seconds
		pSource->Base.Drag = getfloat(pstr);
		pSource->CurTime = pSource->Delay;
	}

	return Proc;

fail:

	Particles_Destroy(Proc);
	return (Procedural*)NULL;
}
/* ------------------------------------------------------------------------------------ */
geSound_Def *SPool_Sound(const char *SName)
{
	SPool *pool;
	geVFile *MainFS;

	if(EffectC_IsStringNull(SName) == GE_TRUE)
	{
		char szError[256];
		sprintf(szError, "[WARNING] File %s - Line %d: Missing Required Field from Entity - Sound File: %s\n",
				__FILE__, __LINE__, SName);
		CCD->ReportError(szError, false);
		// changed QD 07/15/06
		return NULL;
		/*
		CCD->ShutdownLevel();
		delete CCD;
		CCD = NULL;
		MessageBox(NULL, szError, "Sound Manager", MB_OK);
		exit(-333);
		*/
		// end change
	}

	pool = Bottom;

	while(pool != NULL)
	{
		if(!stricmp(SName, pool->Name))
			return pool->SoundDef;

		pool = pool->next;
	}

	CCD->OpenRFFile(&MainFS, kAudioFile, SName, GE_VFILE_OPEN_READONLY);

	if(!MainFS)
		return (geSound_Def*)NULL;

	pool = GE_RAM_ALLOCATE_STRUCT(SPool);
	memset(pool, 0, sizeof(SPool));

// changed QD 07/15/06
	pool->Name = strdup(SName);
	pool->SoundDef = geSound_LoadSoundDef(CCD->Engine()->AudioSystem(), MainFS);
	geVFile_Close(MainFS);

	if(!pool->SoundDef)
	{
		char szError[256];
		sprintf(szError, "[WARNING] File %s - Line %d: Unable to load file, invalid path or filename: %s",
				__FILE__, __LINE__, SName);
		CCD->ReportError(szError, false);
		free(pool->Name);
		geRam_Free(pool);
		return NULL;
		/*
		CCD->ShutdownLevel();
		delete CCD;
		CCD = NULL;
		MessageBox(NULL, szError,"Sound Manager", MB_OK);
		exit(-333);
		*/

	}

	pool->next = Bottom;
	Bottom = pool;

	if(pool->next)
		pool->next->prev = pool;
// end change

	return pool->SoundDef;
}