Example #1
0
TSharedRef<FJsonObject> UFlareSaveWriter::SavePlayer(FFlarePlayerSave* Data)
{
	TSharedRef<FJsonObject> JsonObject = MakeShareable(new FJsonObject());

	JsonObject->SetStringField("ScenarioId", FormatInt32(Data->ScenarioId));
	JsonObject->SetStringField("CompanyIdentifier", Data->CompanyIdentifier.ToString());
	JsonObject->SetStringField("LastFlownShipIdentifier", Data->LastFlownShipIdentifier.ToString());
	JsonObject->SetObjectField("Quest", SaveQuest(&Data->QuestData));

	return JsonObject;
}
Example #2
0
void __cdecl SaveGame()
{
	int v0; // eax
	signed int v1; // ebx
	signed int v2; // esi
	int v3; // esi
	int v4; // esi
	int *v5; // esi
	int *v6; // esi
	int i; // esi
	int *v8; // esi
	int *v9; // esi
	int j; // esi
	int *v11; // esi
	int *v12; // esi
	int k; // esi
	signed int v14; // esi
	int l; // esi
	int m; // esi
	int *v17; // esi
	int *v18; // esi
	int n; // esi
	int *v20; // esi
	char *v21; // edi
	signed int v22; // ebx
	_BYTE *v23; // edi
	signed int v24; // ebx
	char *v25; // edi
	signed int v26; // ebx
	char *v27; // edi
	int (*v28)[112]; // ebx
	int *v29; // edi
	signed int v30; // ebx
	char *v31; // edi
	signed int v32; // ebx
	char *v33; // edi
	signed int v34; // ebx
	char *v35; // edi
	signed int v36; // ebx
	char *v37; // edi
	signed int v38; // ebx
	unsigned char *v39; // edi
	signed int v40; // ebx
	char *v41; // edi
	int v42; // esi
	void *v43; // esi
	int v44; // eax
	char v45[260]; // [esp+Ch] [ebp-10Ch]
	void *ptr; // [esp+110h] [ebp-8h]
	int v47; // [esp+114h] [ebp-4h]

	v0 = codec_get_encoded_len(262147); /* FILEBUFF */
	ptr = DiabloAllocPtr(v0);
	tbuff = ptr;
	ISave_2('RETL');
	OSave(setlevel);
	ISave((unsigned char)setlvlnum);
	ISave(currlevel);
	ISave((unsigned char)leveltype);
	ISave(ViewX);
	ISave(ViewY);
	OSave(invflag);
	OSave(chrflag);
	ISave(nummonsters);
	ISave(numitems);
	ISave(nummissiles);
	ISave(nobjects);
	v1 = 0;
	v2 = 0;
	do
	{
		ISave_2(glSeedTbl[v2]);
		ISave(gnLevelTypeTbl[v2]);
		++v2;
	}
	while ( v2 < 17 );
	SavePlayer(myplr);
	v3 = 0;
	do
		SaveQuest(v3++);
	while ( v3 < 16 );
	v4 = 0;
	do
		SavePortal(v4++);
	while ( v4 < 4 );
	v5 = monstkills;
	do
	{
		ISave_2(*v5);
		++v5;
	}
	while ( (signed int)v5 < (signed int)&monstkills[200] );
	if ( leveltype )
	{
		v6 = monstactive;
		do
		{
			ISave(*v6);
			++v6;
		}
		while ( (signed int)v6 < (signed int)&monstactive[200] );
		for ( i = 0; i < nummonsters; ++i )
			SaveMonster(monstactive[i]);
		v8 = missileactive;
		do
		{
			BSave(*(_BYTE *)v8);
			++v8;
		}
		while ( (signed int)v8 < (signed int)&missileactive[125] );
		v9 = missileavail;
		do
		{
			BSave(*(_BYTE *)v9);
			++v9;
		}
		while ( (signed int)v9 < (signed int)&missileavail[125] );
		for ( j = 0; j < nummissiles; ++j )
			SaveMissile(missileactive[j]);
		v11 = objectactive;
		do
		{
			BSave(*(_BYTE *)v11);
			++v11;
		}
		while ( (signed int)v11 < (signed int)&objectactive[127] );
		v12 = objectavail;
		do
		{
			BSave(*(_BYTE *)v12);
			++v12;
		}
		while ( (signed int)v12 < (signed int)&objectavail[127] );
		for ( k = 0; k < nobjects; ++k )
			SaveObject(objectactive[k]);
		ISave(numlights);
		v14 = 0;
		do
			BSave(lightactive[v14++]);
		while ( v14 < 32 );
		for ( l = 0; l < numlights; ++l )
			SaveLighting((unsigned char)lightactive[l]);
		ISave(visionid);
		ISave(numvision);
		for ( m = 0; m < numvision; ++m )
			SaveVision(m);
	}
	v17 = itemactive;
	do
	{
		BSave(*(_BYTE *)v17);
		++v17;
	}
	while ( (signed int)v17 < (signed int)&itemactive[127] );
	v18 = itemavail;
	do
	{
		BSave(*(_BYTE *)v18);
		++v18;
	}
	while ( (signed int)v18 < (signed int)&itemavail[127] );
	for ( n = 0; n < numitems; ++n )
		SaveItem(itemactive[n]);
	v20 = UniqueItemFlag;
	do
	{
		OSave(*v20);
		++v20;
	}
	while ( (signed int)v20 < (signed int)&UniqueItemFlag[128] );
	do
	{
		v21 = (char *)dTransVal + v1;
		v47 = 112;
		do
		{
			BSave(*v21);
			v21 += 112;
			--v47;
		}
		while ( v47 );
		++v1;
	}
	while ( v1 < 112 );
	v22 = 0;
	do
	{
		v23 = (unsigned char *)dFlags + v22;
		v47 = 112;
		do
		{
			BSave(*v23 & 0xF8);
			v23 += 112;
			--v47;
		}
		while ( v47 );
		++v22;
	}
	while ( v22 < 112 );
	v24 = 0;
	do
	{
		v25 = (char *)dPlayer + v24;
		v47 = 112;
		do
		{
			BSave(*v25);
			v25 += 112;
			--v47;
		}
		while ( v47 );
		++v24;
	}
	while ( v24 < 112 );
	v26 = 0;
	do
	{
		v27 = (char *)dItem + v26;
		v47 = 112;
		do
		{
			BSave(*v27);
			v27 += 112;
			--v47;
		}
		while ( v47 );
		++v26;
	}
	while ( v26 < 112 );
	if ( leveltype )
	{
		v28 = dMonster;
		do
		{
			v29 = (int *)v28;
			v47 = 112;
			do
			{
				ISave(*v29);
				v29 += 112;
				--v47;
			}
			while ( v47 );
			v28 = (int (*)[112])((char *)v28 + 4);
		}
		while ( (signed int)v28 < (signed int)dMonster[1] );
		v30 = 0;
		do
		{
			v31 = (char *)dDead + v30;
			v47 = 112;
			do
			{
				BSave(*v31);
				v31 += 112;
				--v47;
			}
			while ( v47 );
			++v30;
		}
		while ( v30 < 112 );
		v32 = 0;
		do
		{
			v33 = (char *)dObject + v32;
			v47 = 112;
			do
			{
				BSave(*v33);
				v33 += 112;
				--v47;
			}
			while ( v47 );
			++v32;
		}
		while ( v32 < 112 );
		v34 = 0;
		do
		{
			v35 = (char *)dTransVal + v34;
			v47 = 112;
			do
			{
				BSave(*v35);
				v35 += 112;
				--v47;
			}
			while ( v47 );
			++v34;
		}
		while ( v34 < 112 );
		v36 = 0;
		do
		{
			v37 = (char *)dTransVal2 + v36;
			v47 = 112;
			do
			{
				BSave(*v37);
				v37 += 112;
				--v47;
			}
			while ( v47 );
			++v36;
		}
		while ( v36 < 112 );
		v38 = 0;
		do
		{
			v39 = (unsigned char *)automapview + v38;
			v47 = 40;
			do
			{
				OSave(*v39);
				v39 += 40;
				--v47;
			}
			while ( v47 );
			++v38;
		}
		while ( v38 < 40 );
		v40 = 0;
		do
		{
			v41 = (char *)dMissile + v40;
			v47 = 112;
			do
			{
				BSave(*v41);
				v41 += 112;
				--v47;
			}
			while ( v47 );
			++v40;
		}
		while ( v40 < 112 );
	}
	ISave(numpremium);
	ISave(premiumlevel);
	v42 = 0;
	do
		SavePremium(v42++);
	while ( v42 < 6 );
	OSave(automapflag);
	ISave(AutoMapScale);
	pfile_get_game_name(v45);
	v43 = ptr;
	v44 = codec_get_encoded_len((_BYTE *)tbuff - (_BYTE *)ptr);
	pfile_write_save_file(v45, v43, (_BYTE *)tbuff - (_BYTE *)v43, v44);
	mem_free_dbg(v43);
	*(_DWORD *)&gbValidSaveFile = 1;
	pfile_rename_temp_to_perm();
	pfile_write_hero();
}