예제 #1
0
void __fastcall LoadGame(bool firstflag)
{
	int v1; // esi
	int v2; // edi
	int v5; // ebx
	int v6; // eax
	int v7; // eax
	int v8; // ecx
	bool v9; // sf
	unsigned char v10; // of
	int *v11; // esi
	int *v12; // esi
	int i; // esi
	int *v14; // esi
	int *v15; // esi
	int j; // esi
	int *v17; // esi
	int *v18; // esi
	int k; // esi
	int l; // esi
	signed int v21; // esi
	int m; // esi
	int v23; // esi
	int *v24; // esi
	int *v25; // esi
	int n; // esi
	int *v27; // esi
	char *v29; // edi
	char *v30; // edi
	char *v31; // edi
	char *v32; // edi
	int (*v33)[112]; // ebx
	_DWORD *v34; // edi
	char *v35; // edi
	char *v36; // edi
	char *v37; // edi
	char *v38; // edi
	signed int v39; // ebx
	bool *v40; // edi
	char *v41; // edi
	int v42; // esi
	char dst[260]; // [esp+0h] [ebp-120h]
	int len; // [esp+104h] [ebp-1Ch]
	int v46; // [esp+108h] [ebp-18h]
	int v47; // [esp+10Ch] [ebp-14h]
	void *ptr; // [esp+110h] [ebp-10h]
	int v49; // [esp+114h] [ebp-Ch]
	int from_save; // [esp+118h] [ebp-8h]
	int quest_num; // [esp+11Ch] [ebp-4h]

	FreeGameMem();
	pfile_remove_temp_files();
	pfile_get_game_name(dst);
	ptr = pfile_read(dst, &len);
	tbuff = ptr;
	if ( ILoad_2() != 'RETL' )
		TermMsg("Invalid save file");
	setlevel = OLoad();
	setlvlnum = ILoad();
	currlevel = ILoad();
	leveltype = ILoad();
	v1 = ILoad();
	v2 = ILoad();
	invflag = OLoad();
	chrflag = OLoad();
	v5 = ILoad();
	v47 = ILoad();
	v49 = ILoad();
	v6 = ILoad();
	quest_num = 0;
	v46 = v6;
	do
	{
		*(int *)((char *)glSeedTbl + quest_num) = ILoad_2();
		v7 = ILoad();
		v8 = quest_num;
		quest_num += 4;
		v10 = __OFSUB__(quest_num, 68);
		v9 = quest_num - 68 < 0;
		*(int *)((char *)gnLevelTypeTbl + v8) = v7;
	}
	while ( v9 ^ v10 );
	LoadPlayer(myplr);
	quest_num = 0;
	do
		LoadQuest(quest_num++);
	while ( quest_num < 16 );
	quest_num = 0;
	do
		LoadPortal(quest_num++);
	while ( quest_num < 4 );
	LoadGameLevel(firstflag, 4);
	SyncInitPlr(myplr);
	SyncPlrAnim(myplr);
	ViewX = v1;
	numitems = v47;
	nummissiles = v49;
	ViewY = v2;
	nummonsters = v5;
	nobjects = v46;
	v11 = monstkills;
	do
	{
		*v11 = ILoad_2();
		++v11;
	}
	while ( (signed int)v11 < (signed int)&monstkills[200] );
	if ( leveltype )
	{
		v12 = monstactive;
		do
		{
			*v12 = ILoad();
			++v12;
		}
		while ( (signed int)v12 < (signed int)&monstactive[200] );
		for ( i = 0; i < nummonsters; ++i )
			LoadMonster(monstactive[i]);
		v14 = missileactive;
		do
		{
			*v14 = BLoad();
			++v14;
		}
		while ( (signed int)v14 < (signed int)&missileactive[125] );
		v15 = missileavail;
		do
		{
			*v15 = BLoad();
			++v15;
		}
		while ( (signed int)v15 < (signed int)&missileavail[125] );
		for ( j = 0; j < nummissiles; ++j )
			LoadMissile(missileactive[j]);
		v17 = objectactive;
		do
		{
			*v17 = BLoad();
			++v17;
		}
		while ( (signed int)v17 < (signed int)&objectactive[127] );
		v18 = objectavail;
		do
		{
			*v18 = BLoad();
			++v18;
		}
		while ( (signed int)v18 < (signed int)&objectavail[127] );
		for ( k = 0; k < nobjects; ++k )
			LoadObject(objectactive[k]);
		for ( l = 0; l < nobjects; ++l )
			SyncObjectAnim(objectactive[l]);
		numlights = ILoad();
		v21 = 0;
		do
			lightactive[v21++] = BLoad();
		while ( v21 < 32 );
		for ( m = 0; m < numlights; ++m )
			LoadLighting((unsigned char)lightactive[m]);
		visionid = ILoad();
		v23 = 0;
		numvision = ILoad();
		if ( numvision > 0 )
		{
			do
				LoadVision(v23++);
			while ( v23 < numvision );
		}
	}
	v24 = itemactive;
	do
	{
		*v24 = BLoad();
		++v24;
	}
	while ( (signed int)v24 < (signed int)&itemactive[127] );
	v25 = itemavail;
	do
	{
		*v25 = BLoad();
		++v25;
	}
	while ( (signed int)v25 < (signed int)&itemavail[127] );
	for ( n = 0; n < numitems; ++n )
		LoadItem(itemactive[n]);
	v27 = UniqueItemFlag;
	do
	{
		*v27 = OLoad();
		++v27;
	}
	while ( (signed int)v27 < (signed int)&UniqueItemFlag[128] );
	quest_num = 0;
	do
	{
		from_save = 112;
		v29 = (char *)dTransVal + quest_num;
		do
		{
			*v29 = BLoad();
			v29 += 112;
			--from_save;
		}
		while ( from_save );
		++quest_num;
	}
	while ( quest_num < 112 );
	quest_num = 0;
	do
	{
		from_save = 112;
		v30 = (char *)dFlags + quest_num;
		do
		{
			*v30 = BLoad();
			v30 += 112;
			--from_save;
		}
		while ( from_save );
		++quest_num;
	}
	while ( quest_num < 112 );
	quest_num = 0;
	do
	{
		from_save = 112;
		v31 = (char *)dPlayer + quest_num;
		do
		{
			*v31 = BLoad();
			v31 += 112;
			--from_save;
		}
		while ( from_save );
		++quest_num;
	}
	while ( quest_num < 112 );
	quest_num = 0;
	do
	{
		from_save = 112;
		v32 = (char *)dItem + quest_num;
		do
		{
			*v32 = BLoad();
			v32 += 112;
			--from_save;
		}
		while ( from_save );
		++quest_num;
	}
	while ( quest_num < 112 );
	if ( leveltype )
	{
		v33 = dMonster;
		do
		{
			v34 = (unsigned int *)v33;
			from_save = 112;
			do
			{
				*v34 = ILoad();
				v34 += 112;
				--from_save;
			}
			while ( from_save );
			v33 = (int (*)[112])((char *)v33 + 4);
		}
		while ( (signed int)v33 < (signed int)dMonster[1] );
		quest_num = 0;
		do
		{
			from_save = 112;
			v35 = (char *)dDead + quest_num;
			do
			{
				*v35 = BLoad();
				v35 += 112;
				--from_save;
			}
			while ( from_save );
			++quest_num;
		}
		while ( quest_num < 112 );
		quest_num = 0;
		do
		{
			from_save = 112;
			v36 = (char *)dObject + quest_num;
			do
			{
				*v36 = BLoad();
				v36 += 112;
				--from_save;
			}
			while ( from_save );
			++quest_num;
		}
		while ( quest_num < 112 );
		quest_num = 0;
		do
		{
			from_save = 112;
			v37 = (char *)dTransVal + quest_num;
			do
			{
				*v37 = BLoad();
				v37 += 112;
				--from_save;
			}
			while ( from_save );
			++quest_num;
		}
		while ( quest_num < 112 );
		quest_num = 0;
		do
		{
			from_save = 112;
			v38 = (char *)dTransVal2 + quest_num;
			do
			{
				*v38 = BLoad();
				v38 += 112;
				--from_save;
			}
			while ( from_save );
			++quest_num;
		}
		while ( quest_num < 112 );
		v39 = 0;
		do
		{
			v40 = (bool *)automapview + v39;
			from_save = 40;
			do
			{
				*v40 = OLoad();
				v40 += 40;
				--from_save;
			}
			while ( from_save );
			++v39;
		}
		while ( v39 < 40 );
		quest_num = 0;
		do
		{
			from_save = 112;
			v41 = (char *)dMissile + quest_num;
			do
			{
				*v41 = BLoad();
				v41 += 112;
				--from_save;
			}
			while ( from_save );
			++quest_num;
		}
		while ( quest_num < 112 );
	}
	numpremium = ILoad();
	premiumlevel = ILoad();
	v42 = 0;
	do
		LoadPremium(v42++);
	while ( v42 < 6 );
	automapflag = OLoad();
	AutoMapScale = ILoad();
	mem_free_dbg(ptr);
	AutomapZoomReset();
	ResyncQuests();
	if ( leveltype )
		ProcessLightList();
	RedoPlayerVision();
	ProcessVisionList();
	missiles_process_charge();
	ResetPal();
	SetCursor(CURSOR_HAND);
	gbProcessPlayers = 1;
}
예제 #2
0
void CTextures::SetMap(unsigned int ID)
{
	CMaps *Map = GetLoadedMap(ID);

	for (unsigned int i = 0; i < Map->NumberOfPlatforms; i++)
	{
		CPlatforms *CurrentPlatform = GetLoadedPlatform(ID, Map->Platforms[i]->ID);

		if (CurrentPlatform == NULL)
		{
			LoadPlatform(ID, Map->Platforms[i]->ID);
			CurrentPlatform = GetLoadedPlatform(ID, Map->Platforms[i]->ID);
		}

		CPlatforms *NewPlatform = new CPlatforms();

		(*NewPlatform) = (*CurrentPlatform);
		NewPlatform->X = Map->Platforms[i]->X;
		NewPlatform->Y = Map->Platforms[i]->Y;

		Platforms.push_back( NewPlatform );
	}

	for (unsigned int i = 0; i < Map->NumberOfBackgrounds; i++)
	{
		CBackgrounds *CurrentBackground = GetLoadedBackground(ID, Map->Backgrounds[i]->ID);

		if (CurrentBackground == NULL)
		{
			LoadBackground(ID, Map->Backgrounds[i]->ID);
			CurrentBackground = GetLoadedBackground(ID, Map->Backgrounds[i]->ID);
		}

		CBackgrounds *NewBackground = new CBackgrounds();

		(*NewBackground) = (*CurrentBackground);
		NewBackground->X = Map->Backgrounds[i]->X;
		NewBackground->Y = Map->Backgrounds[i]->Y;

		Backgrounds.push_back( NewBackground );
	}

	for (unsigned int i = 0; i < Map->NumberOfMobs; i++)
	{
		CMobs *CurrentMob = GetLoadedMob(Map->Mobs[i]->ID);

		if (CurrentMob == NULL)
		{
			LoadMob(Map->Mobs[i]->ID);
			CurrentMob = GetLoadedMob(Map->Mobs[i]->ID);
		}

		CMobs *NewMob = new CMobs();

		(*NewMob) = (*CurrentMob);
		NewMob->X = Map->Mobs[i]->X;
		NewMob->Y = Map->Mobs[i]->Y;

		NewMob->Instance = i; //Temporary, might be changed. Doesn't look like it needs to be though.

		Mobs.push_back( NewMob );
	}

	for (unsigned int i = 0; i < Map->NumberOfPortals; i++)
	{
		CPortals *CurrentPortal = GetLoadedPortal(Map->Portals[i]->ID);

		if (CurrentPortal == NULL)
		{
			LoadPortal(Map->Portals[i]->ID);
			CurrentPortal = GetLoadedPortal(Map->Portals[i]->ID);
		}

		CPortals *NewPortal = new CPortals();

		(*NewPortal) = (*CurrentPortal);
		NewPortal->PortalID = Map->Portals[i]->ID;
		NewPortal->X = Map->Portals[i]->X;
		NewPortal->Y = Map->Portals[i]->Y;
		NewPortal->TargetMapID = Map->Portals[i]->TargetMapID;

		Portals.push_back( NewPortal );
	}

	Player.CurrentMapID = ID;
}