Esempio n. 1
0
//--------------------------------------------------------------------------
void Omu_Integrator::solve(int kk, double tstart, double tend,
			   Omu_StateVec &xc, Omu_StateVec &dxc, Omu_Vec &q,
			   Omu_DependentVec &Fc)
{
  // call depreciated solve and store results in _xc
  Omu_StateVec &xt = *_xt_ptr;
  Omu_SVarVec &sx = (Omu_SVarVec &)*_x_ptr;
  if (_sa) {
    solve(kk, tstart, tend, sx, *_u_ptr, _sys, xt, xt.Sx, xt.Su);
    m_move(xt.Sx, _nd, 0, _n, _nx, _xc.Sq, 0, 0);
    m_move(xt.Su, _nd, 0, _n, _nu, _xc.Sq, 0, _nx);
  }
  else {
    solve(kk, tstart, tend, sx, *_u_ptr, _sys, xt, MNULL, MNULL);
  }
  v_move(xt, _nd, _n, _xc, 0);
}
Esempio n. 2
0
void CCodeGen::do_merge( COutputSect& old, COutputSect& anew )
{
	switch( old.id() )
	{
	case pl_def : m_pl_def(old, anew); break;
	case pl_id:
	case ven_id:  m_pl_or_ven_id(old, anew); break;
	case if_includes:
	case data_str: m_replace(old, anew); break;
	case pl_ex_impl:
	case pr_meth_impl:
	case ex_meth_impl:
	case in_meth_impl: m_method(old, anew); break;
	case reg_call: m_reg_call(old, anew); break;
	case h_if_def: m_move(old,anew); /*m_drop(old, anew);*/ break;
	default: m_move(old, anew);
	}
}
Esempio n. 3
0
//--------------------------------------------------------------------------
void Omu_Integrator::solve(int kk, double tstart, double tend,
			   const Omu_VariableVec &x, const Omu_VariableVec &u,
			   Omu_Program *sys, Omu_DependentVec &Ft,
			   Omu_StateVec &xt)
{
  _kk = kk;

  // store references to data required by residual() for sys->continuous calls
  _sys = sys;
  _x_ptr = &x;
  _u_ptr = &u;
  _Ft_ptr = &Ft;
  _xt_ptr = &xt;

  // prepare call arguments for high-level solve
  v_move(xt, _nd, _n, _xc, 0);
  if (_sa) {
    m_move(xt.Sx, _nd, 0, _n, _nx, _xc.Sq, 0, 0);
    m_move(xt.Su, _nd, 0, _n, _nu, _xc.Sq, 0, _nx);
  }
  v_move(xt, 0, _nx, _q, 0);
  v_move(u, 0, _nu, _q, _nx);

  // call high-level solve
  solve(kk, tstart, tend, _xc, _dxc, _q, _Fcs[_k]);

  // return results
  v_move(_xc, 0, _n, xt, _nd);
  if (_sa) {
    m_move(_xc.Sq, 0, 0, _n, _nx, xt.Sx, _nd, 0);
    m_move(_xc.Sq, 0, _nx, _n, _nu, xt.Su, _nd, 0);
  }

  // release references to data required by residual()
  _sys = NULL;
  _x_ptr = NULL;
  _u_ptr = NULL;
  _Ft_ptr = NULL;
  _xt_ptr = NULL;
}
Esempio n. 4
0
//--------------------------------------------------------------------------
void Omu_Integrator::setup_struct(int k,
				  const Omu_VariableVec &x,
				  const Omu_VariableVec &u,
				  const Omu_DependentVec &Ft)
{
  // initialize Jacobians for high-level integrator interface

  if (k >= _K) {
    m_error(E_INTERN, "Omu_Integrator::setup_struct"
	    " that was called with wrong integrator setup");
  }

  int i;
  Omu_DepVec &Fc = _Fcs[k];

  init_dims(k, x, u, Ft);

  Fc.size(_n, _n, 0, _n, 0, _nx+_nu);
  m_move(Ft.Jx, _nd, _nd, _n, _n, Fc.Jx, 0, 0);
  m_move(Ft.Jdx, _nd, _nd, _n, _n, Fc.Jdx, 0, 0);
  m_zero(Fc.Jq); // zero Jq wrt. continuous states as Jx gets chained with Sx
  m_move(Ft.Jx, _nd, 0, _n, _nd, Fc.Jq, 0, 0);
  m_move(Ft.Ju, _nd, 0, _n, _nu, Fc.Jq, 0, _nx);

  Fc.c_setup = true;
  for (i = 0; i < _n; i++) {
    int wrt = 0;
    if (Ft.is_linear_element(_nd + i, Omu_Dependent::WRT_x))
      wrt |= Omu_Dependent::WRT_x;
    if (Ft.is_linear_element(_nd + i, Omu_Dependent::WRT_dx))
      wrt |= Omu_Dependent::WRT_dx;
    if ((_nd == 0 || Ft.is_linear_element(_nd + i, Omu_Dependent::WRT_x)) &&
	Ft.is_linear_element(_nd + i, Omu_Dependent::WRT_u))
      wrt |= Omu_Dependent::WRT_q;
    Fc.set_linear_element(i, wrt);
  }
  Fc.analyze_struct();
  Fc.c_setup = false;
}
Esempio n. 5
0
//--------------------------------------------------------------------------
void Omu_Integrator::residual(int kk, double t,
			      const Omu_StateVec &xc, const Omu_StateVec &dxc,
			      const Omu_Vec &q, Omu_DependentVec &Fc)
{
  if (!_sys) {
    m_error(E_NULL, "Omu_Integrator::residual");
  }

  // prepare call arguments
  Omu_DependentVec &Ft = *_Ft_ptr;
  Omu_StateVec &xt = *_xt_ptr;

  v_move(q, 0, _nd, xt, 0);
  v_move(xc, 0, _n, xt, _nd);
  v_move(dxc, 0, _n, _dxt, _nd);
  v_move(q, _nx, _nu, _ut, 0);

  Ft.set_required_J(Fc.is_required_J());
  // note: treat seed derivatives xc.Sq and dxc.Sq to support forward mode

  // call continuous of Omu_Program
  _sys->continuous(kk, t, xt, _ut, _dxt, Ft);

  // return results
  v_move(Ft, _nd, _n, Fc, 0);

  if (Fc.is_required_J()) {
    if (!Fc.Jx.is_constant())
      m_move(Ft.Jx, _nd, _nd, _n, _n, Fc.Jx, 0, 0);
    if (!Fc.Jdx.is_constant())
      m_move(Ft.Jdx, _nd, _nd, _n, _n, Fc.Jdx, 0, 0);
    if (!Fc.Jq.is_constant()) {
      m_move(Ft.Jx, _nd, 0, _n, _nd, Fc.Jq, 0, 0);
      m_move(Ft.Ju, _nd, 0, _n, _nu, Fc.Jq, 0, _nx);
    }
  }
}
Esempio n. 6
0
/* Returns 1 if monster died moving, 0 otherwise */
int dochug(struct monst *mtmp)
{
    struct permonst *mdat;
    int tmp = 0;

    if((mtmp->cham != 0) && (rn2(6) == 0)) {
        newcham(mtmp, &mons[(dlevel + 14) + rn2((CMNUM - 14) - dlevel)]);
    }

    mdat = mtmp->data;

    if(mdat->mlevel < 0) {
        panic("bad monster %c (%d)", mdat->mlet, mdat->mlevel);
    }

    if((((moves % 20) == 0) || (index("ViT", mdat->mlet) != 0))
       && (mtmp->mhp < mtmp->orig_hp)) {
        /* Regenerate monsters. */
        ++mtmp->mhp;
    }

    if(mtmp->mfroz != 0) {
        /* Frozen monsters don't do anything. */
        return 0;
    }

    if(mtmp->msleep != 0) {
        /* Wake up a monster, or get out of here. */
        if((cansee(mtmp->mx, mtmp->my) != 0)
	   && (Stealth == 0)
	   && ((index("NL", mdat->mlet) == 0)
	       || (rn2(50) == 0))
	   && ((Aggravate_monster != 0) 
	       || ((rn2(7) == 0) && (mtmp->mimic == 0)))) {
            mtmp->msleep = 0;
        }
        else {
            return 0;
        }
    }

    /* Not frozen or sleeping: wipe out texts written in the dust */
    wipe_engr_at(mtmp->mx, mtmp->my, 1);

    /* Confused monsters get unconfused with small probability */
    if((mtmp->mconf != 0) && (rn2(50) == 0)) {
        mtmp->mconf = 0;
    }

    /* Some monsters teleport */
    if((mtmp->mflee != 0)
       && (index("tNL", mdat->mlet) != 0) 
       && (rn2(40) == 0)) {
        rloc(mtmp);

        return 0;
    }

    if(mdat->mmove < rnd(6)) {
        return 0;
    }

    if((mtmp->mflee != 0)
       || (mtmp->mconf != 0)
       || ((index("BIuy", mdat->mlet) != 0) && (rn2(4) == 0))
       || ((mdat->mlet == 'L') 
           && (u.ugold == 0)
           && ((mtmp->mgold != 0) || (rn2(2) != 0)))
       || (dist(mtmp->mx, mtmp->my) > 2)
       || ((mtmp->mcansee == 0) && (rn2(4) == 0))
       || (mtmp->mpeaceful != 0)) {
        tmp = m_move(mtmp, 0);
        if((tmp != 0) && (mdat->mmove < 12)) {
            if(tmp == 2) {
                return 1;
            }
            else {
                return 0;
            }
        }
    }

    if(tmp == 2) {
        /* Monster died moving */
        return 1;
    }

    if((index("Ea", mdat->mlet) == 0) 
       && (dist(mtmp->mx, mtmp->my) < 3)
       && (mtmp->mpeaceful == 0)
       && (u.uhp > 0)
       && (sengr_at("Elbereth", u.ux, u.uy) == 0)
       && (sobj_at(SCR_SCARE_MONSTER, u.ux, u.uy) == 0)) {
        if(mhitu(mtmp) != 0) {
            /* Monster died (e.g. 'y' or 'F') */
            return 1;
        }   
    }
        
    /* Extra movement for fast monsters */
    if((mdat->mmove - 12) > rnd(12)) {
        tmp = m_move(mtmp, 1);
    }

    if(tmp == 2) {
        return 1;
    }
    else {
        return 0;
    }
}
Esempio n. 7
0
/* u.dx and u.dy must be set */
bool
attack(struct monst *mtmp)
{
	schar tmp;
	boolean malive = TRUE;
	struct permonst *mdat;

	mdat = mtmp->data;
	u_wipe_engr(3);   /* andrew@orca: prevent unlimited pick-axe attacks */

	if (mdat->mlet == 'L' && !mtmp->mfroz && !mtmp->msleep &&
	    !mtmp->mconf && mtmp->mcansee && !rn2(7) &&
	    (m_move(mtmp, 0) == 2 /* he died */ || /* he moved: */
	     mtmp->mx != u.ux + u.dx || mtmp->my != u.uy + u.dy))
		return (FALSE);

	if (mtmp->mimic) {
		if (!u.ustuck && !mtmp->mflee)
			u.ustuck = mtmp;
		switch (levl[u.ux + u.dx][u.uy + u.dy].scrsym) {
		case '+':
			pline("The door actually was a Mimic.");
			break;
		case '$':
			pline("The chest was a Mimic!");
			break;
		default:
			pline("Wait! That's a Mimic!");
		}
		wakeup(mtmp);	/* clears mtmp->mimic */
		return (TRUE);
	}

	wakeup(mtmp);

	if (mtmp->mhide && mtmp->mundetected) {
		struct obj *obj;

		mtmp->mundetected = 0;
		if ((obj = o_at(mtmp->mx, mtmp->my)) && !Blind)
			pline("Wait! There's a %s hiding under %s!",
			      mdat->mname, doname(obj));
		return (TRUE);
	}

	tmp = u.uluck + u.ulevel + mdat->ac + abon();
	if (uwep) {
		if (uwep->olet == WEAPON_SYM || uwep->otyp == PICK_AXE)
			tmp += uwep->spe;
		if (uwep->otyp == TWO_HANDED_SWORD)
			tmp -= 1;
		else if (uwep->otyp == DAGGER)
			tmp += 2;
		else if (uwep->otyp == CRYSKNIFE)
			tmp += 3;
		else if (uwep->otyp == SPEAR &&
			 strchr("XDne", mdat->mlet))
			tmp += 2;
	}
	if (mtmp->msleep) {
		mtmp->msleep = 0;
		tmp += 2;
	}
	if (mtmp->mfroz) {
		tmp += 4;
		if (!rn2(10))
			mtmp->mfroz = 0;
	}
	if (mtmp->mflee)
		tmp += 2;
	if (u.utrap)
		tmp -= 3;

	/* with a lot of luggage, your agility diminishes */
	tmp -= (inv_weight() + 40) / 20;

	if (tmp <= rnd(20) && !u.uswallow) {
		if (Blind)
			pline("You miss it.");
		else
			pline("You miss %s.", monnam(mtmp));
	} else {
		/* we hit the monster; be careful: it might die! */

		if ((malive = hmon(mtmp, uwep, 0)) == TRUE) {
			/* monster still alive */
			if (!rn2(25) && mtmp->mhp < mtmp->mhpmax / 2) {
				mtmp->mflee = 1;
				if (!rn2(3))
					mtmp->mfleetim = rnd(100);
				if (u.ustuck == mtmp && !u.uswallow)
					u.ustuck = 0;
			}
#ifndef NOWORM
			if (mtmp->wormno)
				cutworm(mtmp, u.ux + u.dx, u.uy + u.dy,
					uwep ? uwep->otyp : 0);
#endif /* NOWORM */
		}
		if (mdat->mlet == 'a') {
			if (rn2(2)) {
				pline("You are splashed by the blob's acid!");
				losehp_m(rnd(6), mtmp);
				if (!rn2(30))
					corrode_armor();
			}
			if (!rn2(6))
				corrode_weapon();
		}
	}
	if (malive && mdat->mlet == 'E' && canseemon(mtmp)
	    && !mtmp->mcan && rn2(3)) {
		if (mtmp->mcansee) {
			pline("You are frozen by the floating eye's gaze!");
			nomul((u.ulevel > 6 || rn2(4)) ? rn1(20, -21) : -200);
		} else {
			pline("The blinded floating eye cannot defend itself.");
			if (!rn2(500))
				if ((int)u.uluck > LUCKMIN)
					u.uluck--;
		}
	}
	return (TRUE);
}
Esempio n. 8
0
/*{{{  main*/
int main(int argc, char *argv[])
{
  /*{{{  variables*/
  enum { NOTHING, LOCAL, REMOTE } in=NOTHING;
  int c;
  int x,y;
  int mouse_x,mouse_y;
  int image_width,image_height;
  int image_xoffset=0,image_yoffset=0;
  int my_width,my_height;
  int err=0,usage=0;
  BITMAP *bp;
  FILE *input;
  static struct menu_entry menu[] = { { "quit","q" } };
  char file[_POSIX_PATH_MAX];
  /*}}}  */

  /*{{{  parse arguments*/
  while ((c=getopt(argc,argv,"l:r:"))!=EOF)
  {
    switch (c)
    {
      /*{{{  l file*/
      case 'l':
      {
        if ((input=fopen(optarg,"r"))==(FILE*)0)
        {
          fprintf(stderr,"%s: Can't open %s\r\n",argv[0],optarg);
          err=1;
        }
        else in=LOCAL;
        break;
      }
      /*}}}  */
      /*{{{  r file*/
      case 'r':
      {
        char *cwd;

        in=REMOTE;
        if (*optarg!='/' && *optarg!='.')
        {
          if ((cwd=getcwd((char*)0,(size_t)0))!=(char*)0) { strcpy(file,cwd); strcat(file,"/"); strcat(file,optarg); }
          else { fprintf(stderr,"%s: Can't get current directory\r\n",argv[0]); err=1; }
        }
        else strcpy(file,optarg);
        break;
      }
      /*}}}  */
      /*{{{  default*/
      default:
      {
        usage=1;
        break;
      }
      /*}}}  */
    }
  }
  if (err) exit(err);
  if (usage || optind!=argc)
  {
    fprintf(stderr,"Usage: mgrview [-l file | -r file]\n");
    exit(1);
  }
  if (in==NOTHING) { in=LOCAL; input=stdin; }
  /*}}}  */
  /*{{{  setup*/
  ckmgrterm(argv[0]);
  m_setup(M_MODEOK);
  signal(SIGINT,clean);
  signal(SIGTERM,clean);
  signal(SIGPIPE,clean);
  m_ttyset();
  m_push(P_MENU|P_EVENT|P_FLAGS);
  m_setmode(M_ABS);
  m_setcursor(CS_INVIS);
  menu_load(1,1,menu);
  m_setevent(REDRAW, "R");
  m_setevent(RESHAPE, "R");
  m_setevent(BUTTON_1,"[%p]");
  m_setevent(BUTTON_2,"m");
  m_flush();
  /*}}}  */
  if (in==LOCAL)
  {
    /*{{{  load bitmap to client space*/
    if ((bp=bitmapread(input))==(BITMAP*)0)
    {
      fprintf(stderr,"%s: No MGR bitmap.\r\n",argv[0]);
      clean(1);
    }
    image_width=BIT_WIDE(bp);
    image_height=BIT_HIGH(bp);
    /*}}}  */
    /*{{{  transfer bitmap to server space*/
    m_func(BIT_SRC);
    m_bitcreate(IMAGE_BITMAP,image_width,image_height);
    m_bitldto(image_width,image_height,0,0,IMAGE_BITMAP,bit_size(image_width,image_height,BIT_DEPTH(bp)));
    fwrite(BIT_DATA(bp),bit_size(image_width,image_height,BIT_DEPTH(bp)),1,m_termout);
    m_flush();
    bit_destroy(bp);
    /*}}}  */
  }
  else if (in==REMOTE)
  {
    /*{{{  transfer bitmap from server fs to server space*/
    m_bitfromfile(IMAGE_BITMAP,file);
    m_get();
    if (sscanf(m_linebuf,"%d %d",&image_width,&image_height)<2)
    {
      fprintf(stderr,"%s: No MGR bitmap.\r\n",argv[0]);
      clean(1);
    }
    /*}}}  */
  }
  /*{{{  user interaction*/
  get_size((int*)0,(int*)0,&my_width,&my_height);
  display(image_xoffset,image_yoffset,my_width,my_height,image_width,image_height);
  m_flush();
  while ((c=getc(m_termin))!='q') switch (c)
  {
    /*{{{  m -- left button displays menu*/
    case 'm':
    {
      m_selectmenu(1);
      m_flush();
      break;
    }
    /*}}}  */
    /*{{{  [%d %d] -- right button*/
    case '[':
    {
      fscanf(m_termin,"%d %d]",&mouse_x,&mouse_y);
      /*{{{  compute new x start*/
      if (my_width>image_width) image_xoffset=0;
      else if (mouse_x<=0) image_xoffset=0;
      else if (mouse_x>=my_width) image_xoffset=my_width-image_width;
      else
      {
        /*{{{  move x start by difference from mouse and middle*/
        image_xoffset=image_xoffset-(mouse_x-my_width/2);
        /*}}}  */
        /*{{{  check and corrent range of x start*/
        if (image_xoffset<my_width-image_width) image_xoffset=my_width-image_width;
        else if (image_xoffset>0) image_xoffset=0;
        /*}}}  */
      }
      /*}}}  */
      /*{{{  compute new y start*/
      if (my_height>image_height) image_yoffset=0;
      else if (mouse_y<=0) image_yoffset=0;
      else if (mouse_y>=my_height) image_yoffset=my_height-image_height;
      else
      {
        /*{{{  move y start by difference from mouse and middle*/
        image_yoffset=image_yoffset-(mouse_y-my_height/2);
        /*}}}  */
        /*{{{  check and corrent range of y start*/
        if (image_yoffset<my_height-image_height) image_yoffset=my_height-image_height;
        else if (image_yoffset>0) image_yoffset=0;
        /*}}}  */
      }
      /*}}}  */
      display(image_xoffset,image_yoffset,my_width,my_height,image_width,image_height);
      m_flush();
      break;
    }
    /*}}}  */
    /*{{{  R -- redraw*/
    case 'R':
    {
      get_size((int*)0,(int*)0,&my_width,&my_height);
      /*{{{  compute new x offset*/
      if (my_width<image_width)
      {
        if (image_xoffset<my_width-image_width) image_xoffset=my_width-image_width;
      }
      else image_xoffset=0;
      /*}}}  */
      /*{{{  compute new y offset*/
      if (my_height<image_height)
      {
        if (image_yoffset<my_height-image_height) image_yoffset=my_height-image_height;
      }
      else image_yoffset=0;
      /*}}}  */
      m_func(BIT_CLR);
      m_bitwrite(0,0,my_width,my_height);
      m_func(BIT_SRC);
      m_bitcopyto(image_xoffset,image_yoffset,image_width,image_height,0,0,WINDOW_BITMAP,IMAGE_BITMAP);
      m_flush();
      break;
    }
    /*}}}  */
  }
  /*}}}  */
  /*{{{  exit*/
  m_bitdestroy(IMAGE_BITMAP);
  get_colrow(&x,&y);
  m_move(0,y-1);
  clean(0);
  /* NOTREACHED */
  return 255;
  /*}}}  */
}
Esempio n. 9
0
void g_updateGame()
{
	if (game.state == STATE_IDLE)
	{
		//do nothing
	}
	else if (game.state == STATE_MENU)
	{	
		//menuSound = m_move;
		
		switch ( m_move() )
		{
			case SND_MENUMOVE:
				s_playSound(menuMove);
				break;
			case SND_MENUSELECT:
				s_playSound(menuSelect);
				break;
			case SND_NONE:
			default:
				break;
		}
		/*
		if ( !m_move() )
		{
			//too much output
			//printf("[g_updateGame]: m_move returned false!\n");
		}
		*/
	}
	else if (game.state == STATE_PLAYING)
	{	
		//game.currentTime = SDL_GetTicks();
		
		//take note of the frame here, see if it is time to move the current tetro
		//1 notch down
		if ( dropFrameInterval >= dropIntervalPerRow[game.level] && !game.isSoftDropping ) //time to drop down 1, only if down arrow not already held down
		{
			dropFrameInterval = 0;

			if ( !tetro_move(game.current, DIR_SOUTH) ) //the periodic drop down was blocked
			{
				//printf("[g_updateGame]: periodic drop down blocked!\n");
				g_onDownBlocked();
			}
			//game.lastDropTime = game.currentTime;
		}
		
		
			
		//rotate has priority
		if ( game.current->tryRotate )
		{
			debug_msg("[g_updateGame]: trying rotate...\n");
			if ( tetro_rotate(game.current) )
			{
				debug_msg("[g_updateGame]: rotate success!\n");
				s_playSound(rotate);
			}
			else
				debug_msg("[g_updateGame]: rotate failed!\n");
		}
		
		//for delayed auto shifting
		if ( game.dasDir != DIR_NONE )
		{
			game.current->nextMoveY = DIR_NONE;
			if ( game.dasDelaying )
			{
				if ( game.dasFrame >= DAS_DELAY )
				{
					game.dasDelaying = false;
					game.current->nextMoveX = game.dasDir;
					game.dasFrame = 0;
				}
			}
			else
			{
				if ( game.dasFrame >= DAS_PERIOD )
				{
					game.current->nextMoveX = game.dasDir;
					game.dasFrame = 0;
				}
			}
			game.dasFrame++;
		}
		//printf("game.dasFrame = %d\n", game.dasFrame);
		
		if ( game.isSoftDropping )
		{
			if ( game.softDropFrame >= SOFT_DROP_FRAMES ) //time to move down a notch
			{
				game.softDropFrame = 0;
				if ( !tetro_move(game.current, DIR_SOUTH) )
				{
					//printf("[g_updateGame]: periodic drop down blocked!\n");
					g_onDownBlocked();
					game.softDropFrame = SOFT_DROP_FRAMES; //next block insta drop down
					game.score += game.softDropDistanceCount;
					game.softDropDistanceCount = 0;
				}
				else
					game.softDropDistanceCount++;
			}
			game.softDropFrame++;
		}
		else
		{
			//create resultant move direction
			if ( game.current->nextMoveX == DIR_NONE )
				game.current->nextMoveDir = game.current->nextMoveY;
			else if ( game.current->nextMoveY == DIR_NONE )
				game.current->nextMoveDir = game.current->nextMoveX;
			else if ( game.current->nextMoveY == DIR_NORTH )
			{
				if ( game.current->nextMoveX == DIR_WEST )
					game.current->nextMoveDir = DIR_NORTHWEST;
				else
					game.current->nextMoveDir = DIR_NORTHEAST;
			}
			else //nextMoveY == south
			{
				if ( game.current->nextMoveX == DIR_WEST )
					game.current->nextMoveDir = DIR_SOUTHWEST;
				else
					game.current->nextMoveDir = DIR_SOUTHEAST;
			}
		
			//attempt to move tetro in this direction
			if ( !tetro_move(game.current, game.current->nextMoveDir) )
			{
				printf("move failed no sound\n");
				//printf("[g_updateGame]: tetro_move failed!\n");
				if ( game.current->nextMoveDir == DIR_SOUTH  || game.current->nextMoveDir == DIR_SOUTHWEST || game.current->nextMoveDir == DIR_SOUTHEAST )
				{
					g_onDownBlocked();
				}
			}
			else if ( game.current->nextMoveDir == DIR_WEST || game.current->nextMoveDir == DIR_EAST ) //successful move, check to see if i should play a sound
			{
				printf("play move because move succeeded west or east\n");
				//if ( game.dasFrame == 0 && game.dasDelaying == true )
					s_playSound(moveSideways);
			}
		}
		
		game.current->nextMoveX = DIR_NONE;
		game.current->nextMoveY = DIR_NONE;
		game.current->nextMoveDir = DIR_NONE;
		game.current->tryRotate = false;

		dropFrameInterval++;
	}
	else if (game.state == STATE_LOSS)
	{
		//the idea: every frame fill up one of the spaces with a "dead" block. so in 180 frames the whole screen will be filled
		short i;
		block * b;
		
		if (game.lossFrame == -1)
		{
			//do nothing
		}
		else
		{
			if (game.lossCurrentRow >= SIZE_Y)
			{
				g_clear(REASON_LOSS);
			}
			else
			{
				if (game.lossFrame == 0)
					SDL_Delay(LOSS_PAUSE);
				
				if (game.lossFrame % 3 == 0)
				{
					for ( i = 0; i < SIZE_X; i++ )
					{
						b = g_getBlockAtPos(i, game.lossCurrentRow);
						if (b != NULL)
							g_removeBlockFromPos(b);
						b = NULL;
					
						b = block_create(TETRO_DEAD, NULL);
						if ( !block_teleport(b, i, game.lossCurrentRow) )
							debug_msg("[g_updateGame]: STATE_LOSS- error teleporting dead block into position!\n");
						b = NULL;
					}
					game.lossCurrentRow++;
				}
			}
		}
		
		game.lossFrame++;
	}		
	else
		debug_msg("[g_updateGame]: unknown game.state!\n");
	
	menu.nextMoveDir = DIR_NONE;
}