Exemple #1
0
static void tetris_event(UINT32 param1, UINT32 param2)
{
    if (param1 == CTRL_MSG_TYPE_CMD - USER_MSG_GO_DOWN)
    {
        GoDown(&x, &y, &CurrentShape, &Status);
    }
}
Exemple #2
0
//
// Used by SUB_UseTargets, when a platform is the target of a button.
// Start bringing platform down.
//
void CFuncPlat::PlatUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	if( IsTogglePlat() )
	{
		// Top is off, bottom is on
		const bool on = m_toggle_state == TS_AT_BOTTOM;

		if( !ShouldToggle( useType, on ) )
			return;

		if( m_toggle_state == TS_AT_TOP )
			GoDown();
		else if( m_toggle_state == TS_AT_BOTTOM )
			GoUp();
	}
	else
	{
		SetUse( NULL );

		if( m_toggle_state == TS_AT_TOP )
			GoDown();
	}
}
Exemple #3
0
//======================================================//
void UpDownLineEdit::keyPressEvent(QKeyEvent * ke) 
{
    puts("UpDownLineEdit::keyPressEvent(QKeyEvent * ke)");
    
    switch(ke->key())    {
    case Qt::Key_Up :
	GoUp();
	break;	
    case Qt::Key_Down :
	GoDown();
	break;		}
    
    QLineEdit::keyPressEvent(ke);
}
Exemple #4
0
void CFuncPlat::Blocked( CBaseEntity *pOther )
{
	ALERT( at_aiconsole, "%s Blocked by %s\n", STRING( pev->classname ), STRING( pOther->pev->classname ) );
	// Hurt the blocker a little
	pOther->TakeDamage( this, this, 1, DMG_CRUSH );

	if( pev->noiseMovement )
		STOP_SOUND( ENT( pev ), CHAN_STATIC, ( char* ) STRING( pev->noiseMovement ) );

	// Send the platform back where it came from
	ASSERT( m_toggle_state == TS_GOING_UP || m_toggle_state == TS_GOING_DOWN );
	if( m_toggle_state == TS_GOING_UP )
		GoDown();
	else if( m_toggle_state == TS_GOING_DOWN )
		GoUp();
}
Exemple #5
0
void Entity::SearchWay(double& next_x, double& next_y ){
		    
  for(int j=0; j<=3; ++j){
      roll_die();
  }		    
	int tmp=roll_die();
	
	if(tmp==1){
	   GoRight();
	}
	else if(tmp==2){
	   GoUp();
	}
	else if(tmp==3){
	  GoLeft();
	}
	else if(tmp==4){
	  GoDown();
	}  
}
Exemple #6
0
void Grapple::Refresh()
{
  if (!attached)
    return ;

  if (move_left_pressed && !move_right_pressed) {
    GoLeft();
  } else if (move_right_pressed && !move_left_pressed) {
    GoRight();
  }

  if (move_up_pressed && !move_down_pressed) {
    GoUp();
  } else if (move_down_pressed && !move_up_pressed) {
    GoDown();
  }

  ActiveCharacter().SetMovement("ninja-rope");
  ActiveCharacter().UpdatePosition();
}
Exemple #7
0
//======================================================//
UpDownLineEdit::UpDownLineEdit(QWidget *parent, const char *name, QString possible_value)
    : QLineEdit(parent, name),	possible_val(possible_value)
{    
    buttonUp = new QPushButton(parent, "buttonUp");
    //QPixmap pm ("./image/arrow_up.png");
    QPixmap pm = QPixmap::fromMimeSource("arrow_up.png");
    buttonUp->setPixmap( pm);
    
    buttonDown = new QPushButton(parent, "buttonDown");
    //pm = QPixmap("./image/arrow_down.png");
    pm = QPixmap::fromMimeSource("arrow_down.png");
    buttonDown->setPixmap( pm);
    
    setPosition(0, 0);
    setMaxLength(1);
    setReadOnly(true);
    setAlignment(Qt::AlignHCenter);
    
    QFont f = font();
    f.setPointSize(12);
    f.setBold(false);
    setFont(f);
    
    buttonUp->setFocusPolicy(QWidget::NoFocus);
    buttonDown->setFocusPolicy(QWidget::NoFocus);
    
    QSizePolicy sp (QSizePolicy::Fixed, QSizePolicy::Fixed);
    setSizePolicy(sp);
    buttonUp->setSizePolicy(sp);
    buttonDown->setSizePolicy(sp);
    
    buttonUp->setFlat(true);
    buttonDown->setFlat(true);
    
    connect ( buttonUp, SIGNAL(clicked()), SLOT(GoUp()) );
    connect ( buttonDown, SIGNAL(clicked()), SLOT(GoDown()) );
    
    index = 0;
    //puts("UpDownCreate");
}
Exemple #8
0
/* <12d69c> ../cstrike/dlls/plats.cpp:235 */
NOBODY void CFuncPlat::CallGoDown(void)
{
	GoDown();
}
Exemple #9
0
static PRESULT tetris_key_proc(UINT32 vkey, UINT8 key_repeat_cnt, UINT8 key_status)
{
    	UINT8   back_saved;
	PRESULT ret = PROC_LOOP;
	if (key_status == PAN_KEY_PRESSED)
	{
		switch (vkey)
		{
			case V_KEY_UP:
				ChangeShape(&x, &y, &CurrentShape, &Status);
				break;

			case V_KEY_DOWN:
				GoDown(&x, &y, &CurrentShape, &Status);
				if (key_repeat_cnt == 0)
				{
				/* speed up drop speed */
				osal_timer_set(GAME_CYCLIC_ID, 100);
				speed_up = TRUE;
				}
				break;

			case V_KEY_LEFT: 
				GoLeft(&x, &y, &CurrentShape, &Status);
				break;

			case V_KEY_RIGHT: 
				GoRight(&x, &y, &CurrentShape, &Status);
				break;

			case V_KEY_ENTER:
				if (playing == TRUE)
				{
					osal_timer_activate(GAME_CYCLIC_ID, FALSE);

					win_compopup_init(WIN_POPUP_TYPE_OK);
					win_compopup_set_frame(GET_MID_L(170), GET_MID_T(130), 170, 130);                    
					win_compopup_set_msg(NULL, NULL, RS_PAUSE);
					win_compopup_open_ext(&back_saved);

					osal_timer_activate(GAME_CYCLIC_ID, TRUE);
				}
				break;

			case V_KEY_MENU:
			case V_KEY_EXIT:
				if (playing == TRUE)
				{
					osal_timer_activate(GAME_CYCLIC_ID, FALSE);

					win_compopup_init(WIN_POPUP_TYPE_OKNO);
					//win_compopup_set_frame(GET_MID_L(250), GET_MID_T(130), 250, 130);
					win_compopup_set_frame(GET_MID_L(250), GET_MID_T(130), 320, 130);
					win_compopup_set_msg(NULL, NULL, RS_GAME_MSG_DO_YOU_QUIT);
					if (win_compopup_open_ext(&back_saved) == WIN_POP_CHOICE_YES)
					{
						playing = FALSE;

						tetris_init();
 						update_status(Speed, Erasered, TotalMark);
 						tetris_redraw_main();
 						tetris_redraw_preview();

						OSD_SetAttr((POBJECT_HEAD)&txt_start, C_ATTR_ACTIVE);
						OSD_ChangeFocus((POBJECT_HEAD)&game_con, 1, \
						C_UPDATE_FOCUS | C_DRAW_SIGN_EVN_FLG);
					}
					else
					{
						osal_timer_activate(GAME_CYCLIC_ID, TRUE);
					}
				}
				break;
			default:
				ret = PROC_PASS;
		}
	}
	else if (key_status == PAN_KEY_RELEASE)
	{
		normal_speed();
	}

	return ret;
}