Example #1
0
// This function should be called, when the worldmap starts or any level is started
void CPlayer::setupforLevelPlay()
{
	plastfalling = true;
	solid = true;
	pShowDir.x = RIGHT;
	ppogostick = false;
	pjumping = PNOJUMP;
    psliding = psemisliding = false;
    pfrozentime = 0;
    keyprocstate = 0;         // KPROC_IDLE
    pjustjumped = pjustfell = true;
    pfireframetimer = 0;
  	object_chosen = false;
    lastpogo = false;
  	hintused = false;
  	exitXpos = 0;
    pjustfell = false;
    plastfalling = false;
    pfalling = false;
    pwalking = playspeed = 0;
    xinertia = pinertia_y = 0;
    plastfire = pfiring = false;
    pwalkanimtimer = 0;
    inhibitfall = false;
  	mLevelTrigger = LVLTRIG_NONE;
  	checkObjSolid();
}
////
// Process the stuff of the player when playing in a normal level
void CPlayer::processInLevel()
{
    StatusBox();

    if (pdie) dieanim();
	else
	{
		inhibitwalking = false;
		inhibitfall = false;		
		
		// when walking through the exit door don't show keen's sprite past
		// the door frame (so it looks like he walks "through" the door)
		if(!pfrozentime)
		{
			if (!level_done)
				ProcessInput();
			else
				ProcessExitLevel();
		}
		
		setDir();
		
		if(!level_done)
		{
			getgoodies();
			raygun();
			keencicle();
		}
		
		if(!pfrozentime)
		{
			if(!pjumping)
			{
				Walking();
				WalkingAnimation();
			}
		}

		checkSolidDoors();

		InertiaAndFriction_X();

		if(!level_done)
		{
			TogglePogo_and_Switches();
			JumpAndPogo();
		}

		// Check collision with other objects
		performCollisions();
		checkObjSolid();
		if(!inhibitfall) Playerfalling();
	}

    processEvents();

    if(pSupportedbyobject)
    	blockedd = true;
}