Exemplo n.º 1
0
unsigned int ON_ComponentStatus::SetSelectedState(
  ON_ComponentState selected_state,
  bool bSynchronizeHighlight
  )
{
  bool bChanged = false;
  switch (selected_state)
  {
  case ON_ComponentState::NotSelected:
    if ( 0 != ClearStates(ON_ComponentStatus::Selected) )
      bChanged = true;
    if ( bSynchronizeHighlight && 0 != ClearStates(ON_ComponentStatus::Highlighted) )
      bChanged = true;
    break;

  case ON_ComponentState::Selected:
    if ( 0 != SetStates(ON_ComponentStatus::Selected) )
      bChanged = true;
    if ( bSynchronizeHighlight && 0 != SetStates(ON_ComponentStatus::Highlighted) )
      bChanged = true;
    break;

  case ON_ComponentState::SelectedPersistent:
    if ( 0 != SetStates(ON_ComponentStatus::SelectedPersistent) )
      bChanged = true;
    if ( bSynchronizeHighlight && 0 != SetStates(ON_ComponentStatus::Highlighted) )
      bChanged = true;
    break;
  }

  return bChanged ? 1U : 0U;
}
Exemplo n.º 2
0
void RandKeysUtil::SetupWindow(HWND hWnd)
	{	
	this->hWnd = hWnd;

	CheckDlgButton(hWnd,IDC_RANDKEYS_TIME,doTime);
	CheckDlgButton(hWnd,IDC_RANDKEYS_VAL,doVal);

	iPosTime = GetISpinner(GetDlgItem(hWnd,IDC_RANDKEYS_POSTIMESPIN));
	iPosTime->SetLimits(0, TIME_PosInfinity, FALSE);
	iPosTime->SetScale(10.0f);
	iPosTime->LinkToEdit(GetDlgItem(hWnd,IDC_RANDKEYS_POSTIME), EDITTYPE_TIME);
	iPosTime->SetValue(posTime,FALSE);

	iNegTime = GetISpinner(GetDlgItem(hWnd,IDC_RANDKEYS_NEGTIMESPIN));
	iNegTime->SetLimits(0, TIME_PosInfinity, FALSE);
	iNegTime->SetScale(10.0f);
	iNegTime->LinkToEdit(GetDlgItem(hWnd,IDC_RANDKEYS_NEGTIME), EDITTYPE_TIME);
	iNegTime->SetValue(negTime,FALSE);

	iPosVal = GetISpinner(GetDlgItem(hWnd,IDC_RANDKEYS_POSVALSPIN));
	iPosVal->SetLimits(0.0f, 999999999.9f, FALSE);
	iPosVal->SetScale(0.1f);
	iPosVal->LinkToEdit(GetDlgItem(hWnd,IDC_RANDKEYS_POSVAL), EDITTYPE_FLOAT);
	iPosVal->SetValue(posVal,FALSE);

	iNegVal = GetISpinner(GetDlgItem(hWnd,IDC_RANDKEYS_NEGVALSPIN));
	iNegVal->SetLimits(0.0f, 999999999.0f, FALSE);
	iNegVal->SetScale(0.1f);
	iNegVal->LinkToEdit(GetDlgItem(hWnd,IDC_RANDKEYS_NEGVAL), EDITTYPE_FLOAT);
	iNegVal->SetValue(negVal,FALSE);

	SetStates();
	}
Exemplo n.º 3
0
long	
MFCQuaStateDisplay::CreateStateDisplay(char *label, CRect &r, CWnd *w, long id, short ns, long *sta)
{
	long ret = Create(label, WS_CHILD|WS_VISIBLE|SS_OWNERDRAW, r, w, id);
	SetStates(ns, sta);

	return ret;
}
Exemplo n.º 4
0
CFWL_CaretImp::CFWL_CaretImp(const CFWL_WidgetImpProperties& properties,
                             IFWL_Widget* pOuter)
    : CFWL_WidgetImp(properties, pOuter),
      m_hTimer(nullptr),
      m_dwElapse(400),
      m_bSetColor(FALSE) {
    m_pTimer = new CFWL_CaretTimer(this);
    SetStates(FWL_STATE_CAT_HightLight);
}
Exemplo n.º 5
0
FWL_ERR CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) {
    if (m_hTimer) {
        FWL_StopTimer(m_hTimer);
        m_hTimer = NULL;
    }
    if (bFlag) {
        m_hTimer = FWL_StartTimer(m_pTimer, m_dwElapse);
    }
    return SetStates(FWL_WGTSTATE_Invisible, !bFlag);
}
Exemplo n.º 6
0
void CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) {
  if (m_pTimerInfo) {
    m_pTimerInfo->StopTimer();
    m_pTimerInfo = nullptr;
  }
  if (bFlag)
    m_pTimerInfo = m_pTimer->StartTimer(m_dwElapse, true);

  SetStates(FWL_WGTSTATE_Invisible, !bFlag);
}
Exemplo n.º 7
0
FWL_ERR CFWL_ToolTipImp::Hide() {
  SetStates(FWL_WGTSTATE_Invisible, TRUE);
  if (m_hTimerHide) {
    FWL_StopTimer(m_hTimerHide);
    m_hTimerHide = NULL;
  }
  if (m_hTimerShow) {
    FWL_StopTimer(m_hTimerShow);
    m_hTimerShow = NULL;
  }
  return TRUE;
}
Exemplo n.º 8
0
void CFWL_Form::EndDoModal() {
  if (!m_pNoteLoop)
    return;

#if (_FX_OS_ == _FX_OS_MACOSX_)
  m_pNoteLoop->EndModalLoop();
  const CFWL_App* pApp = GetOwnerApp();
  if (!pApp)
    return;

  CFWL_NoteDriver* pDriver =
      static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
  if (!pDriver)
    return;

  pDriver->PopNoteLoop();
  SetStates(FWL_WGTSTATE_Invisible);
#else
  SetStates(FWL_WGTSTATE_Invisible);
  m_pNoteLoop->EndModalLoop();
#endif
}
Exemplo n.º 9
0
	/**
	*Copy constructor that does a deep copy of all members
	*
	*@param rhs = the block to become
	*/
	BlockEntity::BlockEntity(const BlockEntity& rhs) : Entity(""), mPlayer(rhs.mPlayer), mX(0), mY(0), mW(32), mH(32), mRenderer(*TetrominoRender::GetInstance()), mOldX(0), mOldY(0), mCollider(mX, mY, mW, mH), lastDirection(), mState(rhs.mState), mWasNotified(false)
	{
		InternalAttribute(State, 1, Datum::INTEGER, &mState);
		InternalAttribute(value, 4, Datum::DatumType::INTEGER, mValues);
		InternalAttribute(Player, 1, Datum::DatumType::INTEGER, &mPlayer);
		Populate();

		Event<EventMessageAttributed>::Subscribe(this);
		blocks.push_back(this);
		//Get the states
		auto values = rhs.Find("value");
		SetStates(values->Get<int>(0), values->Get<int>(1), values->Get<int>(2), values->Get<int>(3));

		auto* rhsColorDatum = rhs.Find("BlockColor");
		auto& colorDatum = (*this)["BlockColor"];
		colorDatum.SetType(Datum::DatumType::STRING);
		colorDatum = rhsColorDatum->Get<std::string>();

	}
Exemplo n.º 10
0
/**	\brief	The OglSdlFinishUpdate function

	\param	vidwait	wait for video sync

	\return	void
*/
void OglSdlFinishUpdate(boolean waitvbl)
{
	static boolean oldwaitvbl = false;
	int sdlw, sdlh;
	if (oldwaitvbl != waitvbl)
	{
		SDL_GL_SetSwapInterval(waitvbl ? 1 : 0);
	}

	oldwaitvbl = waitvbl;

	SDL_GetWindowSize(window, &sdlw, &sdlh);

	HWR_MakeScreenFinalTexture();
	HWR_DrawScreenFinalTexture(sdlw, sdlh);
	SDL_GL_SwapWindow(window);

	SetModelView(realwidth, realheight);
	SetStates();
}
Exemplo n.º 11
0
/**	\brief	The OglSdlSurface function

	\param	w	width
	\param	h	height
	\param	isFullscreen	if true, go fullscreen

	\return	if true, changed video mode
*/
boolean OglSdlSurface(INT32 w, INT32 h)
{
	INT32 cbpp;
	const GLvoid *glvendor = NULL, *glrenderer = NULL, *glversion = NULL;

	cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;

	glvendor = pglGetString(GL_VENDOR);
	// Get info and extensions.
	//BP: why don't we make it earlier ?
	//Hurdler: we cannot do that before intialising gl context
	glrenderer = pglGetString(GL_RENDERER);
	glversion = pglGetString(GL_VERSION);
	gl_extensions = pglGetString(GL_EXTENSIONS);

	DBG_Printf("Vendor     : %s\n", glvendor);
	DBG_Printf("Renderer   : %s\n", glrenderer);
	DBG_Printf("Version    : %s\n", glversion);
	DBG_Printf("Extensions : %s\n", gl_extensions);
	oglflags = 0;

	if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
		pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
	else
		maximumAnisotropy = 1;

	SetupGLFunc13();

	granisotropicmode_cons_t[1].value = maximumAnisotropy;

	SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);

	SetModelView(w, h);
	SetStates();
	pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

	HWR_Startup();
	textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;

	return true;
}
Exemplo n.º 12
0
unsigned int ON_ComponentStatus::SetHighlightedState(
  bool bIsHighlighted
  )
{
  return bIsHighlighted ? SetStates(ON_ComponentStatus::Highlighted) : ClearStates(ON_ComponentStatus::Highlighted);
}
Exemplo n.º 13
0
		void TimeSelectionChanged() {SetStates();}
Exemplo n.º 14
0
/**	\brief	The OglSdlSurface function

	\param	w	width
	\param	h	height
	\param	isFullscreen	if true, go fullscreen

	\return	if true, changed video mode
*/
boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen)
{
	INT32 cbpp;
	Uint32 OGLFlags;
	const GLvoid *glvendor = NULL, *glrenderer = NULL, *glversion = NULL;

	cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;

	if (vidSurface)
	{
		//Alam: SDL_Video system free vidSurface for me
#ifdef VOODOOSAFESWITCHING
		SDL_QuitSubSystem(SDL_INIT_VIDEO);
		SDL_InitSubSystem(SDL_INIT_VIDEO);
#endif
	}

	if (isFullscreen)
		OGLFlags = FOGLFlags;
	else
		OGLFlags = WOGLFlags;

	cbpp = SDL_VideoModeOK(w, h, cbpp, OGLFlags);
	if (cbpp < 16)
		return true; //Alam: Let just say we did, ok?

	vidSurface = SDL_SetVideoMode(w, h, cbpp, OGLFlags);
	if (!vidSurface)
		return false;

	glvendor = pglGetString(GL_VENDOR);
	// Get info and extensions.
	//BP: why don't we make it earlier ?
	//Hurdler: we cannot do that before intialising gl context
	glrenderer = pglGetString(GL_RENDERER);
	glversion = pglGetString(GL_VERSION);
	gl_extensions = pglGetString(GL_EXTENSIONS);

	DBG_Printf("Vendor     : %s\n", glvendor);
	DBG_Printf("Renderer   : %s\n", glrenderer);
	DBG_Printf("Version    : %s\n", glversion);
	DBG_Printf("Extensions : %s\n", gl_extensions);
	oglflags = 0;

#ifdef _WIN32
	// BP: disable advenced feature that don't work on somes hardware
	// Hurdler: Now works on G400 with bios 1.6 and certified drivers 6.04
	if (strstr(glrenderer, "810")) oglflags |= GLF_NOZBUFREAD;
#elif defined (unix) || defined (UNIXCOMMON)
	// disable advanced features not working on somes hardware
	if (strstr(glrenderer, "G200")) oglflags |= GLF_NOTEXENV;
	if (strstr(glrenderer, "G400")) oglflags |= GLF_NOTEXENV;
#endif
	DBG_Printf("oglflags   : 0x%X\n", oglflags );

#ifdef USE_PALETTED_TEXTURE
	if (isExtAvailable("GL_EXT_paletted_texture", gl_extensions))
		glColorTableEXT = SDL_GL_GetProcAddress("glColorTableEXT");
	else
		glColorTableEXT = NULL;
#endif

#ifdef USE_WGL_SWAP
	if (isExtAvailable("WGL_EXT_swap_control", gl_extensions))
		wglSwapIntervalEXT = SDL_GL_GetProcAddress("wglSwapIntervalEXT");
	else
		wglSwapIntervalEXT = NULL;
#else
	if (isExtAvailable("GLX_SGI_swap_control", gl_extensions))
		glXSwapIntervalSGIEXT = SDL_GL_GetProcAddress("glXSwapIntervalSGI");
	else
		glXSwapIntervalSGIEXT = NULL;
#endif

#ifndef KOS_GL_COMPATIBILITY
	if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
		pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
	else
#endif
		maximumAnisotropy = 0;

	granisotropicmode_cons_t[1].value = maximumAnisotropy;

	SetModelView(w, h);
	SetStates();
	pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

	HWR_Startup();
#ifdef KOS_GL_COMPATIBILITY
	textureformatGL = GL_ARGB4444;
#else
	textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;
#endif

	return true;
}
Exemplo n.º 15
0
void XBoss::Run()
{
Object *o = mainobject;
int i;

	if (!mainobject) return;
	if (o->state == 0 || (!X.initilized && o->state != STATE_X_APPEAR))
	{
		o->hp = 1;
		o->x = -(Graphics::SCREEN_WIDTH << CSF);
		return;
	}
	
	switch(o->state)
	{
		// script triggered us to initilize/appear
		// (there is a hvtrigger, right before player first walks by us
		// and sees us inactive, which sends us this ANP).
		case STATE_X_APPEAR:
		{
			if (!X.initilized)
			{
				Init();
				X.initilized = true;
			}
		}
		break;
		
		// script has triggered the fight to begin
		case STATE_X_FIGHT_BEGIN:
		{
			o->timer = 0;
			o->state++;
		}
		case STATE_X_FIGHT_BEGIN+1:
		{
			if (++o->timer > 100)
			{
				FACEPLAYER;
				o->timer = 0;
				o->state = STATE_X_TRAVEL;
			}
		}
		break;
		
		// starts the treads and moves us in the currently-facing direction
		case STATE_X_TRAVEL:
		{
			// count number of times we've traveled, we brake
			// and attack every third time.
			o->timer2++;
			
			o->timer = 0;
			o->state++;
		}
		case STATE_X_TRAVEL+1:
		{
			o->timer++;
			
			// trigger the treads to start moving,
			// and put them slightly out of sync with each-other.
			for(int i=0;i<4;i++)
			{
				if (o->timer == tread_turnon_times[i])
				{
					treads[i]->state = STATE_TREAD_RUN;
					treads[i]->dir = o->dir;
				}
			}
			
			if (o->timer > 120)
			{
				// time to attack? we attack every 3rd travel
				// if so skid to a stop, that's the first step.
				if (o->timer2 >= 3)
				{
					o->timer2 = 0;
					
					o->dir ^= 1;
					o->state = STATE_X_BRAKE;
					o->timer = 0;
				}
				else
				{
					// passed player? skid and turn around.
					if ((o->dir == RIGHT && o->x > player->x) || \
					 	(o->dir == LEFT  && o->x < player->x))
					{
						o->dir ^= 1;
						o->state = STATE_X_TRAVEL;
					}
				}
			}
		}
		break;
		
		// skidding to a stop in preparation to attack
		case STATE_X_BRAKE:
		{
			o->timer = 0;
			o->state++;
		}
		case STATE_X_BRAKE+1:
		{
			o->timer++;
			
			// trigger the treads to start braking,
			// and put them slightly out of sync with each-other.
			for(int i=0;i<4;i++)
			{
				if (o->timer == tread_turnon_times[i])
				{
					treads[i]->state = STATE_TREAD_BRAKE;
					treads[i]->dir = o->dir;
				}
			}
			
			if (o->timer > 50)
			{
				o->state = STATE_X_OPEN_DOORS;
				o->timer = 0;
			}
		}
		break;
		
		// doors opening to attack
		case STATE_X_OPEN_DOORS:
		{
			o->timer = 0;
			o->savedhp = o->hp;
			
			// select type of attack depending on where we are in the battle
			if (!AllTargetsDestroyed())
			{
				SetStates(doors, 2, STATE_DOOR_OPENING);
				o->state = STATE_X_FIRE_TARGETS;
			}
			else
			{
				SetStates(doors, 2, STATE_DOOR_OPENING_PARTIAL);
				o->state = STATE_X_FIRE_FISHIES;
			}
		}
		break;
		
		// firing targets (early battle)
		case STATE_X_FIRE_TARGETS:
		{
			if (doors[0]->state == STATE_DOOR_FINISHED)
			{
				doors[0]->state = 0;
				SetStates(targets, 4, STATE_TARGET_FIRE);
			}
			
			if (++o->timer > 300 || AllTargetsDestroyed())
			{
				o->state = STATE_X_CLOSE_DOORS;
				o->timer = 0;
			}
		}
		break;
		
		// firing fishy missiles (late battle)
		case STATE_X_FIRE_FISHIES:
		{
			if (doors[0]->state == STATE_DOOR_FINISHED)
			{
				doors[0]->state = 0;
				
				SetStates(fishspawners, 4, STATE_FISHSPAWNER_FIRE);
				internals->flags |= FLAG_SHOOTABLE;
			}
			
			if (++o->timer > 300 || (o->savedhp - o->hp) > 200)
			{
				o->state = STATE_X_CLOSE_DOORS;
				o->timer = 0;
			}
		}
		break;
		
		// doors closing after attack
		case STATE_X_CLOSE_DOORS:
		{
			o->timer = 0;
			o->state++;
			
			SetStates(doors, 2, STATE_DOOR_CLOSING);
		}
		case STATE_X_CLOSE_DOORS+1:
		{
			if (doors[0]->state == STATE_DOOR_FINISHED)
			{
				doors[0]->state = 0;
				
				// just turn off everything for both types of attacks;
				// turning off the attack type that wasn't enabled isn't harmful.
				SetStates(targets, 4, 0);
				SetStates(fishspawners, 4, 0);
				internals->flags &= ~FLAG_SHOOTABLE;
			}
			
			if (++o->timer > 50)
			{
				FACEPLAYER;
				o->state = STATE_X_TRAVEL;
				o->timer = 0;
			}
		}
		break;
		
		// exploding
		case STATE_X_EXPLODING:
		{
			SetStates(fishspawners, 4, 0);
			KillObjectsOfType(OBJ_X_FISHY_MISSILE);
			
			StartScript(1000);
			o->timer = 0;
			o->state++;
		}
		case STATE_X_EXPLODING+1:
		{
			game.quaketime = 2;
			o->timer++;
			
			if ((o->timer % 8) == 0)
				sound(SND_ENEMY_HURT_BIG);
			
			SmokePuff(o->CenterX() + (random(-72, 72) << CSF),
					  o->CenterY() + (random(-64, 64) << CSF));
			
			if (o->timer > 100)
			{
				starflash.Start(o->CenterX(), o->CenterY());
				sound(SND_EXPLOSION1);
				o->timer = 0;
				o->state++;
			}
		}
		break;
		case STATE_X_EXPLODING+2:
		{
			game.quaketime = 40;
			if (++o->timer > 50)
			{
				CreateObject(o->x, o->y - (24 << CSF), OBJ_X_DEFEATED);
				DeleteMonster();
				return;
			}
		}
		break;
	}
	
	// call AI for all tread pieces
	for(i=0;i<4;i++)
	{
		run_tread(i);
		run_fishy_spawner(i);
	}
}
Exemplo n.º 16
0
unsigned int ON_ComponentStatus::SetDamagedState(
  bool bIsDamaged
  )
{
  return bIsDamaged ? SetStates(ON_ComponentStatus::Damaged) : ClearStates(ON_ComponentStatus::Damaged);
}
Exemplo n.º 17
0
unsigned int ON_ComponentStatus::SetLockedState(
  bool bIsLocked
  )
{
  return bIsLocked ? SetStates(ON_ComponentStatus::Locked) : ClearStates(ON_ComponentStatus::Locked);
}
Exemplo n.º 18
0
unsigned int ON_ComponentStatus::SetHiddenState(
  bool bIsHidden
  )
{
  return bIsHidden ? SetStates(ON_ComponentStatus::Hidden) : ClearStates(ON_ComponentStatus::Hidden);
}
Exemplo n.º 19
0
		void MajorModeChanged() {SetStates();}