Example #1
0
//----------------------------------------------------------------------------//
// Utility function
//
//----------------------------------------------------------------------------//
std::pair<bool,bool> check_tropicality_north_pole_only_world(df::region_map_entry& region,
                                                             int y_pos
                                                             )
{
    int v6;
    bool is_possible_tropical_area_by_latitude = false;
    bool is_tropical_area_by_latitude = false;
    df::world_data* wdata = df::global::world->world_data;

    // Scale the smaller worlds to the big one
    if ( wdata->world_height == 17)
        v6 = 16 * y_pos;
    else if ( wdata->world_height == 33)
        v6 = 8 * y_pos;
    else if ( wdata->world_height == 65)
        v6 = 4 * y_pos;
    else if ( wdata->world_height == 129)
        v6 = 2 * y_pos;
    else
        v6 = y_pos;

    is_possible_tropical_area_by_latitude = v6 > 170;
    int v8 = ((v6 - 200) < 0);
    int v9 = __OFSUB__(v6,200);
    if (!(v8 ^ v9))
        is_tropical_area_by_latitude = true;

    return std::pair<bool,bool>(is_possible_tropical_area_by_latitude,
                                is_tropical_area_by_latitude
                                );
}
Example #2
0
//----------------------------------------------------------------------------//
// Utility function
//
//----------------------------------------------------------------------------//
std::pair<bool,bool> check_tropicality_south_pole_only_world(df::region_map_entry& region,
                                                             int y_pos
                                                             )
{
    int v6 = df::global::world->world_data->world_height - y_pos - 1;
    bool is_possible_tropical_area_by_latitude = false;
    bool is_tropical_area_by_latitude = false;
    df::world_data* wdata = df::global::world->world_data;

    if ( wdata->world_height == 17)
        v6 *= 16;
    else if ( wdata->world_height == 33)
        v6 *= 8;
    else if ( wdata->world_height == 65)
        v6 *= 4;
    else if ( wdata->world_height == 129)
        v6 *= 2;
    else
        v6 *= 1;

    is_possible_tropical_area_by_latitude = v6 > 170;
    int v9 = __OFSUB__(v6,200);
    int v8 = ((v6 - 200) < 0);
    if (!(v8 ^ v9))
        is_tropical_area_by_latitude = true;
//    if ((v6 > 170) && (v6 < 200))
//        is_tropical_area_by_latitude = true;

    return std::pair<bool,bool>(is_possible_tropical_area_by_latitude,
                                is_tropical_area_by_latitude
                                );
}
Example #3
0
//----------------------------------------------------------------------------//
// Utility function
//
//----------------------------------------------------------------------------//
std::pair<bool,bool> check_tropicality_no_poles_world(df::region_map_entry& region,
                                                      int y_pos
                                                      )
{
    bool is_possible_tropical_area_by_latitude = false;
    bool is_tropical_area_by_latitude = false;

    // If there're no poles, tropical area is determined by temperature
    if (region.temperature >= 75)
        is_possible_tropical_area_by_latitude = true;
    int v9 = __OFSUB__(region.temperature,85);
    int v8 = (region.temperature - 85) < 0;
    if (!(v8 ^ v9))
        is_tropical_area_by_latitude = true;

    return std::pair<bool,bool>(is_possible_tropical_area_by_latitude,
                                is_tropical_area_by_latitude
                                );
}
Example #4
0
//----------------------------------------------------------------------------//
// Utility function
//
//----------------------------------------------------------------------------//
std::pair<bool,bool> check_tropicality_both_poles_world(df::region_map_entry& region,
                                                        int y_pos
                                                        )
{
    int v6;
    bool is_possible_tropical_area_by_latitude = false;
    bool is_tropical_area_by_latitude = false;
    df::world_data* wdata = df::global::world->world_data;

    if (y_pos < wdata->world_height/2)
        v6 = 2 * y_pos;
    else
    {
        v6 = wdata->world_height + 2*(wdata->world_height / 2 - y_pos) - 1;
        if (v6 < 0)
            v6 = 0;
        if (v6 >= wdata->world_height)
            v6 = wdata->world_height - 1;
    }

    if (wdata->world_height == 17)
        v6 *= 16;
    else if (wdata->world_height == 33)
        v6 *= 8;
    else if (wdata->world_height == 65)
        v6 *= 4;
    else if (wdata->world_height == 129)
        v6 *= 2;
    else
        v6 *= 1;

    is_possible_tropical_area_by_latitude = v6 > 170;
    int v9 = __OFSUB__(v6,200);
    int v8 = (v6-200) < 0;
    if (!(v8 ^ v9))
        is_tropical_area_by_latitude = true;

    return std::pair<bool,bool>(is_possible_tropical_area_by_latitude,
                                is_tropical_area_by_latitude
                                );
}
Example #5
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;
}