Beispiel #1
0
/*
	Adjust ScaleNum and ScaleDen from Scale
*/
void AdjustScale ()
{
	// Maximum scale
	if ( Scale > ScaleMax )
		Scale = ScaleMax;

	// Increment Scale until >= ScaleMin
	while ( Scale < ScaleMin )
	{
		assert (Scale < 1.0);

		Scale = 1.0f / ((1.0f / Scale) - 1.0f);
	}

	// Set ScaleNum and ScaleDen
	if ( Scale >= 1.0 )
	{
		ScaleNum = (SHORT)Scale;
		ScaleDen = 1;
	}
	else
	{
		ScaleNum = 1;
		ScaleDen = (SHORT)(1.0/Scale + 0.5);
	}

#if 0
	// Adjust Visible map limits
	VisMapMinX = MAPX(0);
	VisMapMaxX = MAPX(ScrMaxX);
	VisMapMinY = MAPY(ScrMaxY);		// Vertical axe is reversed!
	VisMapMaxY = MAPY(0); 			// Vertical axe is reversed!
#endif
}
Beispiel #2
0
// makes the clouds from the falling scene (good ending)
void ai_cloud_spawner(Object *o)
{
Object *cloud;
int type;

	if (o->state == 0)
	{
		for(int i=0;i<4;i++)
		{
			o->cloud.layers[i] = CreateObject(0, 0, OBJ_NULL);
			o->cloud.layers[i]->PushBehind(lowestobject);
		}
		
		o->state = 1;
	}
	
	if (--o->timer < 0)
	{
		o->timer = random(0, 16);
		type = random(0, 3);
		
		cloud = CreateObject(0, 0, OBJ_CLOUD);
		cloud->sprite = cloud_sprites[type];
		
		if (o->dir == LEFT)		// vertical clouds (falling)
		{
			cloud->x = o->x + MAPY(random(-10, 10));
			cloud->y = o->y;
			cloud->yinertia = -(0x1000 >> type);	// each type half as fast as the last
		}
Beispiel #3
0
//////////////////////////////////////////////////////////
// TMapDC
// ------
//  draw grid
void TMapDC::DrawMapGrid (SHORT grid)
{
	if ( grid > 0 )
	{
		SHORT n;
		SHORT mapx0 = (MAPX(0)       - grid) & ~(grid - 1);
		SHORT mapx1 = (MAPX(ScrMaxX) + grid) & ~(grid - 1);
		SHORT mapy0 = (MAPY(ScrMaxY) - grid) & ~(grid - 1);
		SHORT mapy1 = (MAPY(0)       + grid) & ~(grid - 1);

		SetPenColor16 (BLUE);
		for (n = mapx0; n <= mapx1; n += grid)
			DrawMapLine (n, mapy0, n, mapy1);
		for (n = mapy0; n <= mapy1; n += grid)
			DrawMapLine (mapx0, n, mapx1, n);
	}
}
Beispiel #4
0
// curly being carried by Tow Rope
void aftermove_curly_carried(Object *o)
{
	switch(o->state)
	{
		case 0:
		{
			o->state = 1;
			o->frame = 17;
			o->flags &= ~FLAG_SCRIPTONACTIVATE;
			
			// turn on the HVTrigger in Waterway that kills Curly if you haven't
			// drained the water out of her
			if (game.curmap == STAGE_WATERWAY)
			{
				Object *t = FindObjectByID2(220);
				if (t) t->ChangeType(OBJ_HVTRIGGER);
			}
		}
		case 1:
		{	// carried by player
			StickToPlayer(o, -2, -13, -18);
		}
		break;
		
		// floating away after Ironhead battle
		case 10:
		{
			o->xinertia = 0x40;
			o->yinertia = -0x20;
			o->state = 11;
		}
		case 11:
		{
			if (o->y < MAPY(4))	// if in top part of screen, reverse before hitting wall
				o->yinertia = 0x20;
		}
		break;
		
		case 20:
		{
			o->Delete();
		}
		break;
	}
	
}