#include "MW4Headers.hpp"

#include "DeathEntity.hpp"
#include "MWTool.hpp"
#include "MWDamageObject.hpp"

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
	DeathEntity__GameModel::ConstructGameModel(Script *script)
{
	Check_Object(script);

	//
	//--------------
	// Set up stream
	//--------------
	//
	MemoryStream *model_stream = script->modelStream;
	Check_Object(model_stream);
	model_stream->AllocateBytes(sizeof(DeathEntity__GameModel));
	Entity__GameModel::ConstructGameModel(script);
	DeathEntity__GameModel *model =
		Cast_Pointer(DeathEntity__GameModel*, model_stream->GetPointer());
	Check_Object(model);

	NotationFile *model_file = script->modelFile;
	Check_Object(model_file);
	Page *page = model_file->GetPage("GameData");
	Check_Object(page);

	model->m_craterID = -1;
	const char *crater_string;
	if(page->GetEntry("CraterName", &crater_string))
	{
		MString crater_mstring = crater_string;
		model->m_craterID = crater_mstring.GetHashValue();
	}
}
