add: ); pSolarSysState->TintFrame[1] = CaptureDrawable ( CreateDrawable (WANT_PIXMAP, (SWORD)MAP_WIDTH, (SWORD)1, 1)
context: GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth){	RECT r;	DWORD old_seed;	PLANDATAPTR PlanDataPtr;	COUNT i, x, y;	POINT loc;	CONTEXT OldContext;	old_seed = SeedRandom (pPlanetDesc->rand_seed);	OldContext = SetContext (TaskContext);	pSolarSysState->isPFADefined = (BYTE *)HCalloc (sizeof(BYTE) * 255);	pSolarSysState->TintFrame = CaptureDrawable (			CreateDrawable (WANT_PIXMAP, (SWORD)MAP_WIDTH, (SWORD)MAP_HEIGHT, 1)			);	pSolarSysState->PlanetFrameArray = CaptureDrawable (			CreateDrawable (WANT_PIXMAP, DIAMETER, DIAMETER, (COUNT)MAP_WIDTH)				);	if (IsEarth)	{		//Earth uses a pixmap for the topography		pSolarSysState->TopoFrame = CaptureDrawable (				LoadGraphic (EARTH_MASK_ANIM)				);		pSolarSysState->TopoFrame = stretch_frame (				pSolarSysState->TopoFrame, MAP_WIDTH, MAP_HEIGHT, 1				);	} else {		PlanDataPtr = &PlanData[				pPlanetDesc->data_index & ~PLANET_SHIELDED				];		r.corner.x = r.corner.y = 0;		r.extent.width = MAP_WIDTH;		r.extent.height = MAP_HEIGHT;		if (pSolarSysState->hTopoData == 0)		{			pSolarSysState->hTopoData = AllocResourceData (MAP_WIDTH * MAP_HEIGHT, 0);			LockResourceData (pSolarSysState->hTopoData, &pSolarSysState->lpTopoData);		}		if (pSolarSysState->lpTopoData)		{			memset (pSolarSysState->lpTopoData, 0, MAP_WIDTH * MAP_HEIGHT);			switch (PLANALGO (PlanDataPtr->Type))			{				case GAS_GIANT_ALGO:					MakeGasGiant (PlanDataPtr->num_faults,							pSolarSysState->lpTopoData, &r, PlanDataPtr->fault_depth);					break;				case TOPO_ALGO:				case CRATERED_ALGO:					if (PlanDataPtr->num_faults)						DeltaTopography (PlanDataPtr->num_faults,								pSolarSysState->lpTopoData, &r, PlanDataPtr->fault_depth);					for (i = 0; i < PlanDataPtr->num_blemishes; ++i)					{						RECT crater_r;						UWORD loword;										loword = LOWORD (Random ());						switch (HIBYTE (loword) & 31)						{							case 0:								crater_r.extent.width =										(LOBYTE (loword) % (MAP_HEIGHT >> 2))										+ (MAP_HEIGHT >> 2);								break;							case 1:							case 2:							case 3:							case 4:								crater_r.extent.width =										(LOBYTE (loword) % (MAP_HEIGHT >> 3))										+ (MAP_HEIGHT >> 3);								break;							default:								crater_r.extent.width =										(LOBYTE (loword) % (MAP_HEIGHT >> 4))										+ 4;								break;						}											loword = LOWORD (Random ());						crater_r.extent.height = crater_r.extent.width;						crater_r.corner.x = HIBYTE (loword)								% (MAP_WIDTH - crater_r.extent.width);						crater_r.corner.y = LOBYTE (loword)								% (MAP_HEIGHT - crater_r.extent.height);						MakeCrater (&crater_r, pSolarSysState->lpTopoData,								PlanDataPtr->fault_depth << 2,								-(PlanDataPtr->fault_depth << 2),								FALSE);					}					if (PLANALGO (PlanDataPtr->Type) == CRATERED_ALGO)						DitherMap (pSolarSysState->lpTopoData);					ValidateMap (pSolarSysState->lpTopoData);					break;			}		} else {			return;		}		pSolarSysState->TopoFrame = CaptureDrawable (				CreateDrawable (WANT_PIXMAP, (SIZE)MAP_WIDTH, (SIZE)MAP_HEIGHT, 1)				);		pSolarSysState->OrbitalCMap = CaptureColorMap (				LoadColorMap (PlanDataPtr->CMapInstance)				);		pSolarSysState->XlatRef = CaptureStringTable (				LoadStringTable (PlanDataPtr->XlatTabInstance)				);		if (pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature > HOT_THRESHOLD)		{			pSolarSysState->OrbitalCMap = SetAbsColorMapIndex (					pSolarSysState->OrbitalCMap, 2					);			pSolarSysState->XlatRef = SetAbsStringTableIndex (pSolarSysState->XlatRef, 2);		}		else if (pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature > COLD_THRESHOLD)		{			pSolarSysState->OrbitalCMap = SetAbsColorMapIndex (					pSolarSysState->OrbitalCMap, 1					);			pSolarSysState->XlatRef = SetAbsStringTableIndex (pSolarSysState->XlatRef, 1);		}		pSolarSysState->XlatPtr = GetStringAddress (pSolarSysState->XlatRef);		RenderTopography (FALSE);	}	// Generate a pixel array fromthe Topography map.	// We use this instead of lpTopoData because it needs to be WAP_WIDTH+MAP_HEIGHT wide	// and we need this method for Earth anyway.  It may be more efficient to build it	// from lpTopoData instead of the FRAMPTR though	x = MAP_WIDTH + MAP_HEIGHT;	y = MAP_HEIGHT;	pSolarSysState->lpTopoMap = getpixelarray (			pSolarSysState->TopoFrame, x, y			);	// Extend the width from MAP_WIDTH to MAP_WIDTH+MAP_HEIGHT	for (y = 0; y < MAP_HEIGHT; y++)		for (x = 0; x < MAP_HEIGHT; x++)			pSolarSysState->lpTopoMap[y][x + MAP_WIDTH] = pSolarSysState->lpTopoMap[y][x];	if (pSolarSysState->pOrbitalDesc->pPrevDesc == &pSolarSysState->SunDesc[0])	{		// This is a planet.  Get its location		loc = pSolarSysState->pOrbitalDesc->location;	} else {		// This is a moon.  Get its planet's location		loc = pSolarSysState->pOrbitalDesc->pPrevDesc->location;	}	RenderPhongMask (loc);	if (pPlanetDesc->data_index & PLANET_SHIELDED)		CreateShieldMask();	SetContext (OldContext);	SeedRandom (old_seed);	SetPlanetMusic ((UBYTE)(pPlanetDesc->data_index & ~PLANET_SHIELDED));}