main.cpp
// Creates an empty level to the kenv.
// Note that for now it creates objects one by one, but this might change soon...
Creates an empty level to the kenv.
Note that for now it creates objects one by one, but this might change soon
Creates an empty level to the kenv . Note that for now it creates objects one by one but this might change soon
void MakeEmptyXXL1Level(KEnvironment &kenv)
{
	kenv.numSectors = 0;
	kenv.lvlUnk1 = 0;
	static const int clcnt[15] = { 5, 15, 208, 127, 78, 30, 32, 11, 33, 5, 4, 28, 133, 26, 6 };
	static const int definfo[15] = { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 0 };
	for (int i = 0; i < 15; i++) {
		kenv.levelObjects.categories[i].type.resize(clcnt[i]);
		for (auto &cl : kenv.levelObjects.categories[i].type)
			cl.info = definfo[i];
	}
	kenv.levelObjects.getClassType<CKLevel>().info = 0;
	kenv.levelObjects.getClassType<CKCoreManager>().info = 0;
	kenv.levelObjects.getClassType<CKAsterixGameManager>().info = 0;
	kenv.levelObjects.getClassType<CSGRootNode>().info = 1;
	kenv.levelObjects.getClassType<CManager2d>().info = 0;
	kenv.levelObjects.getClassType<CMenuManager>().info = 1;
	kenv.levelObjects.getClassType<CScene2d>().info = 1;
	kenv.levelLoaded = true;
	CKCoreManager *core = kenv.createObject<CKCoreManager>(-1);
	CKGroupRoot *grpRoot = kenv.createObject<CKGroupRoot>(-1);
	CKServiceLife *srvLife = kenv.createObject<CKServiceLife>(-1);
	core->groupRoot = grpRoot;
	core->srvLife = srvLife;
	CKServiceManager *srvManager = kenv.createObject<CKServiceManager>(-1);
	srvManager->addService<CKSrvCinematic>(&kenv);
	CKAsterixGameManager *gameMgr = kenv.createObject<CKAsterixGameManager>(-1);
	CKSector *sector = kenv.createObject<CKSector>(-1);
	sector->strId = 0;
	CKMeshKluster *meshKluster = kenv.createObject<CKMeshKluster>(-1);
	sector->meshKluster = meshKluster;
	CKSoundDictionary *sndDict = kenv.createObject<CKSoundDictionary>(-1);
	sndDict->inactive = 0;
	sector->soundDictionary = sndDict;
	CSGSectorRoot *strRoot = kenv.createObject<CSGSectorRoot>(-1);
	sector->sgRoot = strRoot;
	CKLevel *level = kenv.createObject<CKLevel>(-1);
	level->lvlNumber = 8;
	level->sectors.emplace_back(sector);
	CSGRootNode *sgroot = kenv.createObject<CSGRootNode>(-1);
	CKGraphic *graphic = kenv.createObject<CKGraphic>(-1);
	graphic->kgfcSgRootNode = sgroot;
	CManager2d *mgr2d = kenv.createObject<CManager2d>(-1);
	mgr2d->scene1 = kenv.createObject<CScene2d>(-1);
	mgr2d->scene2 = kenv.createObject<CScene2d>(-1);
	mgr2d->menuManager = kenv.createObject<CMenuManager>(-1);
	mgr2d->menuManager->scene = kenv.createObject<CScene2d>(-1);
	auto *ccon = kenv.createObject<CContainer2d>(-1);
	ccon->e2dUnk1 = 5;
	ccon->e2dUnk2 = 0;
	ccon->scene = mgr2d->menuManager->scene;
	ccon->scene1 = kenv.createObject<CScene2d>(-1);
	ccon->scene2 = kenv.createObject<CScene2d>(-1);
	mgr2d->menuManager->scene->first = mgr2d->menuManager->scene->last = ccon;
	mgr2d->menuManager->scene->numElements = 1;
	auto *msgbox = kenv.createObject<CMessageBox2d>(-1);
	mgr2d->menuManager->messageBox = msgbox;
	msgbox->container = kenv.createObject<CContainer2d>(-1);
	msgbox->text = kenv.createObject<CText2d>(-1);
	msgbox->billboard = kenv.createObject<CBillboard2d>(-1);
	msgbox->button1 = kenv.createObject<CColorTextButton2d>(-1);
	msgbox->button2 = kenv.createObject<CColorTextButton2d>(-1);
	msgbox->button3 = kenv.createObject<CColorTextButton2d>(-1);
	strRoot->texDictionary = kenv.createAndInitObject<CTextureDictionary>(-1);
	sgroot->insertChild(strRoot);
	CKSoundManager *sndmgr = kenv.createObject<CKSoundManager>(-1);
	CKSoundDictionaryID *smSndDict = kenv.createAndInitObject<CKSoundDictionaryID>();
	sndmgr->ksndmgrSndDictID = smSndDict;
}
void MakeEmptyXXL1Level ( KEnvironment & kenv ) { kenv . numSectors = 0 ; kenv . lvlUnk1 = 0 ; static const int clcnt [ 15 ] = { 5 , 15 , 208 , 127 , 78 , 30 , 32 , 11 , 33 , 5 , 4 , 28 , 133 , 26 , 6 } ; static const int definfo [ 15 ] = { 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 2 , 2 , 1 , 2 , 0 } ; for ( int i = 0 ; i < 15 ; i ++ ) { kenv . levelObjects . categories [ i ] . type . resize ( clcnt [ i ] ) ; for ( auto & cl : kenv . levelObjects . categories [ i ] . type ) cl . info = definfo [ i ] ; } kenv . levelObjects . getClassType < CKLevel > ( ) . info = 0 ; kenv . levelObjects . getClassType < CKCoreManager > ( ) . info = 0 ; kenv . levelObjects . getClassType < CKAsterixGameManager > ( ) . info = 0 ; kenv . levelObjects . getClassType < CSGRootNode > ( ) . info = 1 ; kenv . levelObjects . getClassType < CManager2d > ( ) . info = 0 ; kenv . levelObjects . getClassType < CMenuManager > ( ) . info = 1 ; kenv . levelObjects . getClassType < CScene2d > ( ) . info = 1 ; kenv . levelLoaded = true ; CKCoreManager * core = kenv . createObject < CKCoreManager > ( -1 ) ; CKGroupRoot * grpRoot = kenv . createObject < CKGroupRoot > ( -1 ) ; CKServiceLife * srvLife = kenv . createObject < CKServiceLife > ( -1 ) ; core -> groupRoot = grpRoot ; core -> srvLife = srvLife ; CKServiceManager * srvManager = kenv . createObject < CKServiceManager > ( -1 ) ; srvManager -> addService < CKSrvCinematic > ( & kenv ) ; CKAsterixGameManager * gameMgr = kenv . createObject < CKAsterixGameManager > ( -1 ) ; CKSector * sector = kenv . createObject < CKSector > ( -1 ) ; sector -> strId = 0 ; CKMeshKluster * meshKluster = kenv . createObject < CKMeshKluster > ( -1 ) ; sector -> meshKluster = meshKluster ; CKSoundDictionary * sndDict = kenv . createObject < CKSoundDictionary > ( -1 ) ; sndDict -> inactive = 0 ; sector -> soundDictionary = sndDict ; CSGSectorRoot * strRoot = kenv . createObject < CSGSectorRoot > ( -1 ) ; sector -> sgRoot = strRoot ; CKLevel * level = kenv . createObject < CKLevel > ( -1 ) ; level -> lvlNumber = 8 ; level -> sectors . emplace_back ( sector ) ; CSGRootNode * sgroot = kenv . createObject < CSGRootNode > ( -1 ) ; CKGraphic * graphic = kenv . createObject < CKGraphic > ( -1 ) ; graphic -> kgfcSgRootNode = sgroot ; CManager2d * mgr2d = kenv . createObject < CManager2d > ( -1 ) ; mgr2d -> scene1 = kenv . createObject < CScene2d > ( -1 ) ; mgr2d -> scene2 = kenv . createObject < CScene2d > ( -1 ) ; mgr2d -> menuManager = kenv . createObject < CMenuManager > ( -1 ) ; mgr2d -> menuManager -> scene = kenv . createObject < CScene2d > ( -1 ) ; auto * ccon = kenv . createObject < CContainer2d > ( -1 ) ; ccon -> e2dUnk1 = 5 ; ccon -> e2dUnk2 = 0 ; ccon -> scene = mgr2d -> menuManager -> scene ; ccon -> scene1 = kenv . createObject < CScene2d > ( -1 ) ; ccon -> scene2 = kenv . createObject < CScene2d > ( -1 ) ; mgr2d -> menuManager -> scene -> first = mgr2d -> menuManager -> scene -> last = ccon ; mgr2d -> menuManager -> scene -> numElements = 1 ; auto * msgbox = kenv . createObject < CMessageBox2d > ( -1 ) ; mgr2d -> menuManager -> messageBox = msgbox ; msgbox -> container = kenv . createObject < CContainer2d > ( -1 ) ; msgbox -> text = kenv . createObject < CText2d > ( -1 ) ; msgbox -> billboard = kenv . createObject < CBillboard2d > ( -1 ) ; msgbox -> button1 = kenv . createObject < CColorTextButton2d > ( -1 ) ; msgbox -> button2 = kenv . createObject < CColorTextButton2d > ( -1 ) ; msgbox -> button3 = kenv . createObject < CColorTextButton2d > ( -1 ) ; strRoot -> texDictionary = kenv . createAndInitObject < CTextureDictionary > ( -1 ) ; sgroot -> insertChild ( strRoot ) ; CKSoundManager * sndmgr = kenv . createObject < CKSoundManager > ( -1 ) ; CKSoundDictionaryID * smSndDict = kenv . createAndInitObject < CKSoundDictionaryID > ( ) ; sndmgr -> ksndmgrSndDictID = smSndDict ; }
Creates an empty level to the kenv.
Creates an empty level to the kenv .
//CKSrvCinematic *srvCinematic = kenv.createObject<CKSrvCinematic>(-1); //for (CKService* srv : { srvCinematic }) //	srvManager->services.emplace_back(srv); //kenv.createObject<CTextureDictionary>(-1);