//===========================================================================//
// File:	btreg.cc                                                         //
// Project: MUNGA           Brick: Registry Manager								  //
// Contents: Interface specification for Registry Manager						  //
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
// 11/22/94  ECH  Initial coding.                                            //
// 11/29/94  JMA  Changed Identities to IDs                                  //
//---------------------------------------------------------------------------//
// Copyright (C) 1994, Virtual World Entertainment, Inc.                     //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//

#include <bt.hpp>
#pragma hdrstop

#if !defined(BTREG_HPP)
#	include <btreg.hpp>
#endif

#if !defined(BTPLAYER_HPP)
#	include <btplayer.hpp>
#endif

#if !defined(BTDIRECT_HPP)
#	include <btdirect.hpp>
#endif

//
// Registered classes...
//
#if !defined(MECH_HPP)
#	include <mech.hpp>
#endif

#if !defined(PROJTILE_HPP)
#	include <projtile.hpp>
#endif

#if !defined(MISSILE_HPP)
#	include <missile.hpp>
#endif

#if !defined(BTTEAM_HPP)
#	include <btteam.hpp>
#endif

//
//~~~~~~~~~~~~~~~~
// Munga Includes
//~~~~~~~~~~~~~~~~
//
#if !defined(BTMSSN_HPP)
#	include <btmssn.hpp>
#endif

#if !defined(DIRECTOR_HPP)
#	include <director.hpp>
#endif

#if !defined(HOSTMGR_HPP)
#	include <hostmgr.hpp>
#endif

#if !defined(APP_HPP)
#	include <app.hpp>
#endif

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Registry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

//
//#############################################################################
// Registry
//#############################################################################
//
BTRegistry::BTRegistry(ResourceFile *)
{

}

//
//#############################################################################
// ~Registry
//#############################################################################
//
BTRegistry::~BTRegistry()
{
}

//
//#############################################################################
// GetStaticData
//#############################################################################
//
Entity::SharedData*
	BTRegistry::GetStaticData(ClassID class_ID)
{
	switch (class_ID)
	{
	case MechClassID:
		return &Mech::DefaultData;
	case ProjectileClassID:
		return &Projectile::DefaultData;
	case MissileClassID:
		return &Missile::DefaultData;
	case BTPlayerClassID:
		return &BTPlayer::DefaultData;
	case BTTeamClassID:
		return &BTTeam::DefaultData;
	default:
		return Registry::GetStaticData(class_ID);
	}
}

//
//#############################################################################
// GetStaticData
//#############################################################################
//
Player*
	BTRegistry::MakePlayer(Mission *mission)
{
	Check(this);
	Check(mission);
	BTMission *bt_mission = Cast_Object(BTMission *, mission);

	if (strcmp(mission->GetGameModel(), "camera"))
	{
		BTPlayer::MakeMessage
			make_player(
				BTPlayer::MakeMessageID,
				sizeof(BTPlayer::MakeMessage),
				BTPlayerClassID,
				EntityID::Null,
				ResourceDescription::NullResourceID,
				BTPlayer::DefaultFlags,
				Origin::Identity,
				mission->GetPlayerBitmapIndex(),
				bt_mission->GetRoleName(),
				bt_mission->GetTeamName()
			);
		return new BTPlayer(&make_player);
	}

	else
	{
		BTCameraDirector::MakeMessage create_director(
			BTCameraDirector::MakeMessageID,
			sizeof(BTCameraDirector::MakeMessage),
			CameraDirectorClassID,
			EntityID::Null,
			ResourceDescription::NullResourceID,
			BTCameraDirector::DefaultFlags,
			Origin::Identity,
			mission->GetPlayerBitmapIndex()
		);
		return new BTCameraDirector(&create_director);
	}
 }

