示例#1
0
void PlayMenu::AddCharacterToGameSession()
{
	char *player[3] = { "PlayerWizard.xml", "PlayerWarrior.xml", "PlayerAssassin.xml" };
	char *hpBars[3] = { "HpBarWizard.xml", "HpBarWarrior.xml", "HpBarAssassin.xml" };
	char *playersNames[3] = { "wizard", "warrior", "assassin" };

	auto player1 = Object::CreateFromFile(player[indexL]);
	auto player2 = Object::CreateFromFile(player[indexR]);

	player1->SetPos(Vector2f(384, 450));
	player2->SetPos(Vector2f(896, 450));

	player1->GetComponent<PlayerMovement>()->SetControls(0);
	player2->GetComponent<PlayerMovement>()->SetControls(1);

	auto player1CharComp = player1->GetComponent<CharacterComponent>();
	auto player2CharComp = player2->GetComponent<CharacterComponent>();

	player1CharComp->SetEnemy(player2.get());
	player2CharComp->SetEnemy(player1.get());

	player1CharComp->SetControls(0);
	player2CharComp->SetControls(1);

	auto hpBar1 = Object::CreateFromFile(hpBars[indexL]);
	auto hpBar2 = Object::CreateFromFile(hpBars[indexR]);

	hpBar1->SetName("LeftHpBar");
	hpBar2->SetName("RightHpBar");

	hpBar1->SetPos(Vector2f(0, 0));
	hpBar2->SetPos(Vector2f(g_app->APP_RESOLUTION_WIDTH - 200, 0));

	hpBar1->GetComponent<PlayerHpBar>()->SetPlayer(player1.get());
	hpBar2->GetComponent<PlayerHpBar>()->SetPlayer(player2.get());

	auto spellBar1 = Object::Create();
	auto spellBar2 = Object::Create();

	spellBar1->SetPos(Vector2f(0.f, 685.f));
	spellBar2->SetPos(Vector2f(1175.f, 685.f));

	auto spellBar1Comp = spellBar1->AddComponent<SpellFeedbackComponent>();
	auto spellBar2Comp = spellBar2->AddComponent<SpellFeedbackComponent>();

	spellBar1Comp->SetCharacter(playersNames[indexL]);
	spellBar2Comp->SetCharacter(playersNames[indexR]);

	spellBar1Comp->SetCharacter(player1CharComp->GetCharacter());
	spellBar2Comp->SetCharacter(player2CharComp->GetCharacter());

	auto mainGameObject = g_menuHandler->GetMenuObject(MAIN_GAME);

	mainGameObject->AddChild(std::move(player1));
	mainGameObject->AddChild(std::move(player2));
	mainGameObject->AddChild(std::move(hpBar1));
	mainGameObject->AddChild(std::move(hpBar2));
	mainGameObject->AddChild(std::move(spellBar1));
	mainGameObject->AddChild(std::move(spellBar2));
}
void AMurphysLawCharacter::BeginPlay()
{
	Super::BeginPlay();

	// AI settings ressources
	if (AIControllerClass == nullptr) ShowWarning("No AIController class assigned to MurphysLawCharacter");

	if (SwitchingWeaponSound == nullptr) ShowWarning("MurphysLawCharacter - Unable to load the SwitchingWeaponSound");

	// If the InventoryComponent's BeginPlay has not been called yet, we call it
	if (!Inventory->HasBegunPlay())
	{
		Inventory->BeginPlay();
	}

	EquipFirstWeapon();

	// Set the current health of the character here in case the value has been overriden in a subclass
	CurrentHealth = MaxHealth;

	auto NameplateWidget = Cast<UMurphysLawNameplateWidget>(CharacterNameplate->GetUserWidgetObject());
	if (NameplateWidget)
	{
		NameplateWidget->SetCharacter(this);
	}

	// Sets the current stamina level to the maximum
	CurrentStamina = MaxStamina;
}
示例#3
0
void AHeatmapDataCollector::CollectCharacters()
{
	if (cWorld)
	{
		for (TActorIterator<ACharacter> ActorItr(cWorld); ActorItr; ++ActorItr)
		{
			ATDownCharacter* foundedCh = Cast<ATDownCharacter>(*ActorItr);
			//auto isChr = foundedCh->GetClass()->IsChildOf(ATDownCharacter::StaticClass());

			if (foundedCh)
			{
				CharactersArr.Add(foundedCh);
			}
		}
	}
	if (CharNumberInWorld < CharactersArr.Num())
	{
		auto selectChar = Cast<ATDownCharacter>(CharactersArr[CharNumberInWorld]);
		if (selectChar)
		{
			if (!CharCurrentPtr)
			{
				SetCharacter(selectChar);																								// Set pointer to Character  fom CharNumberInWorld
			}
		}
	}

}
示例#4
0
CReconUnit::CReconUnit()
{
  spr_iMoveDistance = 8;
  spr_iVisibilityDistance = 5;
  spr_etTeam = T_NEUTRAL;
  SetCharacter("Recon", T_NEUTRAL);
}
示例#5
0
void CCharEntity::Deactivate()
{
	n_assert(DefaultComposite);
	CEntity::Deactivate();
	DefaultComposite = NULL;
	RagdollComposite = NULL;
	pRagdollImpulse = NULL;
	SetCharacter(NULL);
}
示例#6
0
static void SetPlayer(int character, struct PlayerData *data)
{
	int face, skin, hair;

	face = IndexToHead(data->head);
	skin = IndexToSkin(data->skin);
	hair = IndexToHair(data->hair);
	characterDesc[character].armedBodyPic = BODY_ARMED;
	characterDesc[character].unarmedBodyPic = BODY_UNARMED;
	characterDesc[character].speed = 256;
	characterDesc[character].maxHealth = 200;
	SetCharacter(character, face, skin, hair, data->body, data->arms,
		     data->legs);
}
示例#7
0
文件: mission.c 项目: insin/cdogs-wii
void SetupMissionCharacter(int index, const TBadGuy * b)
{
	SetCharacter(index, b->facePic, b->skinColor, b->hairColor,
		     b->bodyColor, b->armColor, b->legColor);
	characterDesc[index].armedBodyPic = b->armedBodyPic;
	characterDesc[index].unarmedBodyPic = b->unarmedBodyPic;
	characterDesc[index].speed = b->speed;
	characterDesc[index].probabilityToMove = b->probabilityToMove;
	characterDesc[index].probabilityToTrack = b->probabilityToTrack;
	characterDesc[index].probabilityToShoot = b->probabilityToShoot;
	characterDesc[index].actionDelay = b->actionDelay;
	characterDesc[index].defaultGun = b->gun;
	characterDesc[index].maxHealth = b->health;
	characterDesc[index].flags = b->flags;
}
示例#8
0
void TShadow::setActor( TActor* actor )
{
	if ( actor )
	{
		m_fyActor.Object( actor->getFlyActor().Object() );
		
		SetShadowSize( 200 );
		Show( TRUE );

		Vec3D pos( 100 , 100 , 500 );
		SetCharacter( m_fyActor.Object() , pos );
	}
	else
	{
		Show( false );
	}

}
示例#9
0
void XProc_DeleteCharacter::MessageProc( UINT message, WPARAM wparam, LPARAM lparam )
{
	_XWindow_CreateCharacter* pCreateCharacter_Window = (_XWindow_CreateCharacter *)m_WindowManager.FindWindow(_XDEF_WTITLE_CREATECHARACTER);
	
	if( message == WM_COMMAND )
	{
		switch( wparam )
		{		
		case _XDEF_CC_CREATEBUTTON  :

			strcpy(  m_CharacterNameString, pCreateCharacter_Window->m_NameEdit.GetText() );

			if( strlen(m_CharacterNameString) <= 0 )
			{
				g_MessageBox.SetMessage( _XDEF_DLGBTNTYPE_OK, ID_STRING_CREATECHARACTER_EMPTYNAME, TRUE );
			}
			else if( strlen(m_CharacterNameString) <= 1 )
			{
				g_MessageBox.SetMessage( _XDEF_DLGBTNTYPE_OK, ID_STRING_CREATECHARACTER_SHORTNAME, TRUE );
			}			
			else if( pCreateCharacter_Window->m_BonusPoint > 0 )
			{
				g_MessageBox.SetMessage( _XDEF_DLGBTNTYPE_OK, ID_STRING_CREATECHARACTER_USEPOINT, TRUE );
			}			
			else
			{	
				if( strchr( pCreateCharacter_Window->m_NameEdit.GetText(), _T(' ') ) )
				{
					TCHAR warnstring[512];
					strcpy(warnstring, _XGETINTERFACETEXT(ID_STRING_CREATECHARACTER_FILTERNAME));					
					g_MessageBox.SetMessage( _XDEF_DLGBTNTYPE_OK, warnstring, _T("인물 이름에 공백은 사용하실수 없습니다."), TRUE );
				}
				else
				{
					TCHAR resultstring[256]; 
					memset( resultstring, 0x00, 256 );
					strcpy( resultstring, pCreateCharacter_Window->m_NameEdit.GetText() );				
					g_WordFilteringManager.Filtering( resultstring, _XDEF_WORDFILETERINGTYPE_NAME | _XDEF_WORDFILETERINGTYPE_ALWAYS, TRUE );

					// 필터링을 정상적으로 통과하면 서버선택창을 연다.
					if( strcmpi( resultstring, pCreateCharacter_Window->m_NameEdit.GetText() ) == 0 )
					{
						g_MessageBox.SetMessage( _XDEF_DLGBTNTYPE_YESNO, ID_STRING_CREATECHARACTER_CREATECHARACTER, TRUE, _XDEF_CC_CREATECHARACTER );
					}				
					else
					{
						TCHAR warnstring[512];
						strcpy(warnstring, _XGETINTERFACETEXT(ID_STRING_CREATECHARACTER_FILTERNAME));
					
						TCHAR message[512];
						memset( message, 0x00, 512 );
						sprintf( message, "%s(은)는 사용하실수 없는 단어입니다.", g_WordFilteringManager.GetLastFilterdWord() );
						g_MessageBox.SetMessage( _XDEF_DLGBTNTYPE_OK, warnstring, message, TRUE );
					}
				}
			}
			break;		
		case _XDEF_CC_CREATECHARACTER:
			{
				BOOL gendercheck = TRUE;
				
				if( m_SelectedZone == 1 ) // 소림일때 
				{
					if( m_CharacterGender != _XGENDER_MAN )
					{
						g_MessageBox.SetMessage( _XDEF_DLGBTNTYPE_OK, _T(""), _T("소림사에는 여자가 출입할 수 없습니다."), TRUE );
						gendercheck = FALSE;
					}
				}
				else if( m_SelectedZone == 4 ) // 비궁일때 
				{
					if( m_CharacterGender != _XGENDER_WOMAN )
					{
						g_MessageBox.SetMessage( _XDEF_DLGBTNTYPE_OK, _T(""), _T("자하동에는 남자가 출입할 수 없습니다."), TRUE );
						gendercheck = FALSE;
					}
				}					
				
				if( gendercheck )
				{
					strcpy(  m_CharacterNameString, pCreateCharacter_Window->m_NameEdit.GetText() );
					if( pCreateCharacter_Window->m_BonusPoint == 0 && ( strlen(m_CharacterNameString) > 0 ) )
					{
						g_NetworkKernel.SendPacket( MSG_NO_CHARAC_CREATE );
					}
				}
			}			
			break;		
		case _XDEF_CC_CANCELBUTTON	:
			{
				((CEmperorOfDragonsApp*)gApp)->m_proc_selectcharacter.m_PrevProcess_Login = FALSE;
				((CEmperorOfDragonsApp*)gApp)->m_ProcessManager.ChangeProcess( &((CEmperorOfDragonsApp*)gApp)->m_proc_selectcharacter );
			}
			break;
		case _XDEF_CC_REQUESTCHARACTERLIST:
			{
				SetFocus( gHWnd );
				((CEmperorOfDragonsApp*)gApp)->m_proc_selectcharacter.m_PrevProcess_Login = FALSE;
				((CEmperorOfDragonsApp*)gApp)->m_ProcessManager.ChangeProcess( &((CEmperorOfDragonsApp*)gApp)->m_proc_selectcharacter );
			}
			break;

		// 성별
		case _XDEF_CC_WOMENBUTTON :
			{
				m_CharacterGender = _XGENDER_WOMAN;
				m_PreviewCharacter.LinkBipedObject( &g_FemaleBipedObject );
				SetCharacter();
				
				m_CameraMoving = TRUE;
				m_CameraMovingTarget = D3DXVECTOR3( 0.125f, 0.495f, 0.0f );
				m_CameraMovingTargetDistance = 2.6f;

				pCreateCharacter_Window->m_FaceTypeIndex = m_FaceTypeManIndex;
				pCreateCharacter_Window->m_HairTypeIndex = m_HairTypeManIndex;
				pCreateCharacter_Window->m_ClothTypeIndex = m_ClothTypeManIndex;
			}
			break;
		case _XDEF_CC_MANBUTTON	:
			{
				m_CharacterGender = _XGENDER_MAN;
				m_PreviewCharacter.LinkBipedObject( &g_MaleBipedObject );
				SetCharacter();
				
				m_CameraMoving = TRUE;
				m_CameraMovingTarget = D3DXVECTOR3( 0.125f, 0.495f, 0.0f );
				m_CameraMovingTargetDistance = 2.6f;

				pCreateCharacter_Window->m_FaceTypeIndex = m_FaceTypeWomanIndex;
				pCreateCharacter_Window->m_HairTypeIndex = m_HairTypeWomanIndex;
				pCreateCharacter_Window->m_ClothTypeIndex = m_ClothTypeWomanIndex;
			}
			break;

		// 얼굴
		case _XDEF_CC_FACELEFTBUTTON :
			{
				if( g_LodTerrain.m_3PCamera.GetDistance() == 1.4f )
				{
					if( m_CharacterGender == _XGENDER_MAN )
					{
						m_FaceTypeManIndex--;
						if(m_FaceTypeManIndex == 0)
							m_FaceTypeManIndex = 8;						

						pCreateCharacter_Window->m_FaceTypeIndex = m_FaceTypeManIndex;
					}
					else
					{
						m_FaceTypeWomanIndex--;
						if(m_FaceTypeWomanIndex == 0)
							m_FaceTypeWomanIndex = 8;						

						pCreateCharacter_Window->m_FaceTypeIndex = m_FaceTypeWomanIndex;
					}
					SetCharacter();
				}

				m_CameraMoving = TRUE;
				m_CameraMovingTarget = D3DXVECTOR3( 0.125f, 0.895f, 0.0f );
				m_CameraMovingTargetDistance = 1.4f;
			}
			break;
		case _XDEF_CC_FACERIGHTBUTTON :
			{
				if( g_LodTerrain.m_3PCamera.GetDistance() == 1.4f )
				{
					if( m_CharacterGender == _XGENDER_MAN )
					{
						m_FaceTypeManIndex++;
						if(m_FaceTypeManIndex == 9)
							m_FaceTypeManIndex = 1;						
						
						pCreateCharacter_Window->m_FaceTypeIndex = m_FaceTypeManIndex;
					}
					else
					{
						m_FaceTypeWomanIndex++;
						if(m_FaceTypeWomanIndex == 9)
							m_FaceTypeWomanIndex = 1;						

						pCreateCharacter_Window->m_FaceTypeIndex = m_FaceTypeWomanIndex;
					}
					SetCharacter();
				}

				m_CameraMoving = TRUE;
				m_CameraMovingTarget = D3DXVECTOR3( 0.125f, 0.895f, 0.0f );
				m_CameraMovingTargetDistance = 1.4f;
			}
			break;

		// 머리
		case _XDEF_CC_HAIRLEFTBUTTON :
			{
				if( g_LodTerrain.m_3PCamera.GetDistance() == 1.4f )
				{
					if(m_CharacterGender == _XGENDER_MAN)
					{
						m_HairTypeManIndex--;
						if(m_HairTypeManIndex == 0)
							m_HairTypeManIndex = 18;

						pCreateCharacter_Window->m_HairTypeIndex = m_HairTypeManIndex;
					}
					if(m_CharacterGender == _XGENDER_WOMAN)
					{
						m_HairTypeWomanIndex--;
						if(m_HairTypeWomanIndex == 0)
							m_HairTypeWomanIndex = 18;

						pCreateCharacter_Window->m_HairTypeIndex = m_HairTypeWomanIndex;
					}
					SetCharacter();					
				}

				m_CameraMoving = TRUE;
				m_CameraMovingTarget = D3DXVECTOR3( 0.125f, 0.895f, 0.0f );
				m_CameraMovingTargetDistance = 1.4f;
			}
			break;
		case _XDEF_CC_HAIRRIGHTBUTTON :
			{
				if( g_LodTerrain.m_3PCamera.GetDistance() == 1.4f )
				{
					if(m_CharacterGender == _XGENDER_MAN)
					{
						m_HairTypeManIndex++;
						if(m_HairTypeManIndex == 19)
							m_HairTypeManIndex = 1;

						pCreateCharacter_Window->m_HairTypeIndex = m_HairTypeManIndex;
					}
					if(m_CharacterGender == _XGENDER_WOMAN)
					{
						m_HairTypeWomanIndex++;
						if(m_HairTypeWomanIndex == 19)
							m_HairTypeWomanIndex = 1;

						pCreateCharacter_Window->m_HairTypeIndex = m_HairTypeWomanIndex;
					}
					SetCharacter();
				}

				m_CameraMoving = TRUE;
				m_CameraMovingTarget = D3DXVECTOR3( 0.125f, 0.895f, 0.0f );
				m_CameraMovingTargetDistance = 1.4f;
			}
			break;

		// 의상
		case _XDEF_CC_CLOTHLEFTBUTTON :
			{
				if( g_LodTerrain.m_3PCamera.GetDistance() == 2.6f )
				{
					if(m_CharacterGender == _XGENDER_MAN)
					{
						if( m_ClothTypeManIndex == 1 )
						{
							m_ClothTypeManIndex = 2;
						}
						else
						{
							m_ClothTypeManIndex--;
						}
						
						pCreateCharacter_Window->m_ClothTypeIndex = m_ClothTypeManIndex;
					}
					else
					{
						if( m_ClothTypeWomanIndex == 1 )
						{
							m_ClothTypeWomanIndex = 2;
						}
						else
						{
							m_ClothTypeWomanIndex--;
						}

						pCreateCharacter_Window->m_ClothTypeIndex = m_ClothTypeWomanIndex;
					}					
					SetCharacter();
				}

				m_CameraMoving = TRUE;
				m_CameraMovingTarget = D3DXVECTOR3( 0.125f, 0.495f, 0.0f );
				m_CameraMovingTargetDistance = 2.6f;
			}
			break;
		case _XDEF_CC_CLOTHRIGHTBUTTON :
			{
				if( g_LodTerrain.m_3PCamera.GetDistance() == 2.6f )
				{
					if(m_CharacterGender == _XGENDER_MAN)
					{
						if( m_ClothTypeManIndex == 2 )
						{
							m_ClothTypeManIndex = 1;
						}
						else
						{
							m_ClothTypeManIndex++;
						}

						pCreateCharacter_Window->m_ClothTypeIndex = m_ClothTypeManIndex;
					}
					else
					{
						if( m_ClothTypeWomanIndex == 2 )
						{
							m_ClothTypeWomanIndex = 1;
						}
						else
						{
							m_ClothTypeWomanIndex++;
						}

						pCreateCharacter_Window->m_ClothTypeIndex = m_ClothTypeWomanIndex;
					}
					SetCharacter();
				}

				m_CameraMoving = TRUE;
				m_CameraMovingTarget = D3DXVECTOR3( 0.125f, 0.495f, 0.0f );
				m_CameraMovingTargetDistance = 2.6f;
			}
			break;

		case _XDEF_CC_ADDBUTON1 :
			if( pCreateCharacter_Window->m_BonusPoint > 0 )
			{
				m_Parameter[0]++;
				pCreateCharacter_Window->m_Parameter[0] = m_Parameter[0];
				pCreateCharacter_Window->m_BonusPoint--;
			}
			break;
		case _XDEF_CC_SUBBUTON1 :
			if( m_Parameter[0] > _XDEF_DEFALTPARAMETER_1 )
			{
				m_Parameter[0]--;
				pCreateCharacter_Window->m_Parameter[0] = m_Parameter[0];
				pCreateCharacter_Window->m_BonusPoint++;
			}
			break;
		case _XDEF_CC_ADDBUTON2 :
			if( pCreateCharacter_Window->m_BonusPoint > 0 )
			{
				m_Parameter[1]++;
				pCreateCharacter_Window->m_Parameter[1] = m_Parameter[1];
				pCreateCharacter_Window->m_BonusPoint--;
			}
			break;
		case _XDEF_CC_SUBBUTON2 :
			if( m_Parameter[1] > _XDEF_DEFALTPARAMETER_2 )
			{
				m_Parameter[1]--;
				pCreateCharacter_Window->m_Parameter[1] = m_Parameter[1];
				pCreateCharacter_Window->m_BonusPoint++;
			}
			break;
		case _XDEF_CC_ADDBUTON3 :
			if( pCreateCharacter_Window->m_BonusPoint > 0 )
			{
				m_Parameter[2]++;
				pCreateCharacter_Window->m_Parameter[2] = m_Parameter[2];
				pCreateCharacter_Window->m_BonusPoint--;
			}
			break;
		case _XDEF_CC_SUBBUTON3 :
			if( m_Parameter[2] > _XDEF_DEFALTPARAMETER_3 )
			{
				m_Parameter[2]--;
				pCreateCharacter_Window->m_Parameter[2] = m_Parameter[2];
				pCreateCharacter_Window->m_BonusPoint++;
			}
			break;
		case _XDEF_CC_ADDBUTON4 :
			if( pCreateCharacter_Window->m_BonusPoint > 0 )
			{
				m_Parameter[3]++;
				pCreateCharacter_Window->m_Parameter[3] = m_Parameter[3];
				pCreateCharacter_Window->m_BonusPoint--;
			}
			break;
		case _XDEF_CC_SUBBUTON4 :
			if( m_Parameter[3] > _XDEF_DEFALTPARAMETER_4 )
			{
				m_Parameter[3]--;
				pCreateCharacter_Window->m_Parameter[3] = m_Parameter[3];
				pCreateCharacter_Window->m_BonusPoint++;
			}
			break;
		case _XDEF_CC_ADDBUTON5 :
			if( pCreateCharacter_Window->m_BonusPoint > 0 )
			{
				m_Parameter[4]++;
				pCreateCharacter_Window->m_Parameter[4] = m_Parameter[4];
				pCreateCharacter_Window->m_BonusPoint--;
			}
			break;
		case _XDEF_CC_SUBBUTON5 :
			if( m_Parameter[4] > _XDEF_DEFALTPARAMETER_5 )
			{
				m_Parameter[4]--;
				pCreateCharacter_Window->m_Parameter[4] = m_Parameter[4];
				pCreateCharacter_Window->m_BonusPoint++;
			}
			break;
		case _XDEF_CC_AREACHECKBUTTON1 :
		case _XDEF_CC_AREACHECKBUTTON2 :
		case _XDEF_CC_AREACHECKBUTTON3 :
		case _XDEF_CC_AREACHECKBUTTON4 :
		case _XDEF_CC_AREACHECKBUTTON5 :
		case _XDEF_CC_AREACHECKBUTTON6 :
		case _XDEF_CC_AREACHECKBUTTON7 :
		case _XDEF_CC_AREACHECKBUTTON8 :
		case _XDEF_CC_AREACHECKBUTTON9 :
			{
				m_SelectedZone = (wparam - _XDEF_CC_AREACHECKBUTTON1) + 1;

				pCreateCharacter_Window->m_pAreaSelectCheckButton[0]->SetCheck( (m_SelectedZone) == 1 );
				pCreateCharacter_Window->m_pAreaSelectCheckButton[1]->SetCheck( (m_SelectedZone) == 2 );
				pCreateCharacter_Window->m_pAreaSelectCheckButton[2]->SetCheck( (m_SelectedZone) == 3 );
				pCreateCharacter_Window->m_pAreaSelectCheckButton[3]->SetCheck( (m_SelectedZone) == 4 );
			}
			break;		
		default:
			break;
		}
	}
}
示例#10
0
bool
RE_Class::ConstructL (unsigned depth, const uni_char *source, unsigned &index, unsigned length, bool extended)
{
  int range_first = -1;

  for (unsigned i = 0; i < BITMAP_ELEMENTS; ++i)
    bitmap[i] = 0;

  if (source[index] == '^')
    {
      inverted = true;
      ++index;
    }
  else
    inverted = false;

#ifdef RE_FEATURE__CHARACTER_CLASS_INTERSECTION
  if (depth++ >= RE_FEATURE__CHARACTER_CLASS_INTERSECTION_MAX_DEPTH)
    return false;
#endif // RE_FEATURE__CHARACTER_CLASS_INTERSECTION

#ifdef ES_FEATURE__ERROR_MESSAGES
  unsigned range_first_index, range_second_index;
#endif /* ES_FEATURE__ERROR_MESSAGES */

  RE_SKIP_WHITESPACE ();

  RE_ExcludeIncludeRange *eir = OP_NEW_L (RE_ExcludeIncludeRange, (false, 0, INT_MAX));
  OpStackAutoPtr<RE_ExcludeIncludeRange> eir_anchor (eir);

#define SetCharacter(ch) do { SetCharacter (ch); if (!(ch < BITMAP_RANGE)) eir = RE_ExcludeIncludeRange::Include (eir, ch, ch); } while (0)
#define SetRange(first, last) do { SetRange (first, last); if (last >= BITMAP_RANGE) eir = RE_ExcludeIncludeRange::Include (eir, MAX (first, BITMAP_RANGE), last); } while (0)

  while (index < length)
    {
#ifdef ES_FEATURE__ERROR_MESSAGES
      if (range_first == -1)
        range_first_index = index;
#endif /* ES_FEATURE__ERROR_MESSAGES */

      int character = source[index++];

      if (character == ']')
        {
          if (range_first >= 0)
            {
              SetCharacter (range_first);
              SetCharacter ('-');
            }

          --index;
          break;
        }
      else if (character == '\\')
        {
          if (index == length)
            return false;

          character = -2;

          bool builtin_class_handled = false;

          switch (source[index++])
            {
            case '0':
              if (index == length || !RE_Compiler::IsOctalDigit (source[index]))
                {
                  character = 0;
                  break;
                }
              ++index;

            case '1': case '2': case '3': case '4': case '5': case'6': case '7':
              character = 0;
              --index;
              while (index < length && RE_Compiler::IsOctalDigit (source[index]))
                {
                  int next_character = character * 8 + (source[index] - '0');
                  if (next_character > 255)
                    break;
                  character = next_character;
                  ++index;
                }
              break;

            case 'b':
              character = 8;
              break;

            case 't':
              character = 9;
              break;

            case 'n':
              character = 10;
              break;

            case 'v':
              character = 11;
              break;

            case 'f':
              character = 12;
              break;

            case 'r':
              character = 13;
              break;

            case 'd':
              if (builtin_class == BUILTIN_EMPTY || builtin_class == BUILTIN_DIGIT)
                {
                  builtin_class = BUILTIN_DIGIT;
                  builtin_class_handled = true;
                }

              SetRange ('0', '9');
              break;

            case 'D':
              if (builtin_class == BUILTIN_EMPTY || builtin_class == BUILTIN_NON_DIGIT)
                {
                  builtin_class = BUILTIN_NON_DIGIT;
                  builtin_class_handled = true;
                }

              SetRange (0, '0' - 1);
              SetRange ('9' + 1, INT_MAX - 1);
              break;

            case 's':
              if (builtin_class == BUILTIN_EMPTY || builtin_class == BUILTIN_WHITESPACE)
                {
                  builtin_class = BUILTIN_WHITESPACE;
                  builtin_class_handled = true;
                }

              SetRange (9, 13);
              SetCharacter (32);
              SetCharacter (160);
              SetCharacter (0x1680);
              SetCharacter (0x180e);
              SetRange (0x2000, 0x200b);
              SetCharacter (0x2028);
              SetCharacter (0x2029);
              SetCharacter (0x202f);
              SetCharacter (0x205f);
              SetCharacter (0x3000);
              SetCharacter (0xfeff);
              break;

            case 'S':
              if (builtin_class == BUILTIN_EMPTY || builtin_class == BUILTIN_NON_WHITESPACE)
                {
                  builtin_class = BUILTIN_NON_WHITESPACE;
                  builtin_class_handled = true;
                }

              SetRange (0, 8);
              SetRange (14, 31);
              SetRange (33, 159);
              SetRange (161, 0x1680 - 1);
              SetRange (0x1680 + 1, 0x180e - 1);
              SetRange (0x180e + 1, 0x2000 - 1);
              SetRange (0x200b + 1, 0x2028 - 1);
              SetRange (0x2029 + 1, 0x202f - 1);
              SetRange (0x202f + 1, 0x205f - 1);
              SetRange (0x205f + 1, 0x3000 - 1);
              SetRange (0x3000 + 1, 0xfeff - 1);
              SetRange (0xfeff + 1, INT_MAX - 1);
              break;

            case 'w':
              if (builtin_class == BUILTIN_EMPTY || builtin_class == BUILTIN_WORD_CHARACTER)
                {
                  builtin_class = BUILTIN_WORD_CHARACTER;
                  builtin_class_handled = true;
                }

              SetRange ('0', '9');
              SetRange ('A', 'Z');
              SetCharacter ('_');
              SetRange ('a', 'z');
              break;

            case 'W':
              if (builtin_class == BUILTIN_EMPTY || builtin_class == BUILTIN_NON_WORD_CHARACTER)
                {
                  builtin_class = BUILTIN_NON_WORD_CHARACTER;
                  builtin_class_handled = true;
                }

              SetRange (0, '0' - 1);
              SetRange ('9' + 1, 'A' - 1);
              SetRange ('Z' + 1, '_' - 1);
              SetCharacter ('_' + 1);
              SetRange ('z' + 1, INT_MAX - 1);
              break;

            case 'c':
              if (index - length < 2)
                continue;

              if (!RE_Compiler::IsLetter (source[index]))
                continue;

              character = source[index++] % 32;
              break;

            case 'x':
            case 'u':
              if (index - length < 3)
                continue;

#ifdef RE_FEATURE__BRACED_HEXADECIMAL_ESCAPES
              if (source[index] == '{' && RE_Compiler::IsHexDigit (source[index + 1]))
                {
                  unsigned index0 = index + 1;
                  character = 0;

                  while (index0 < length && source[index0] != '}' && RE_Compiler::IsHexDigit (source[index0]))
                    character = (character << 4) | RE_Compiler::HexToCharacter (source[index0++]);

                  if (index0 < length && source[index0] == '}')
                    {
                      index = index0 + 1;
                      break;
                    }

                  character = -2;
                }
#endif // RE_FEATURE__BRACED_HEXADECIMAL_ESCAPES

              if (!RE_Compiler::IsHexDigit (source[index]) || !RE_Compiler::IsHexDigit (source[index + 1]))
                continue;

              if (source[index - 1] == 'x')
                {
                  character = RE_Compiler::HexToCharacter (source[index + 1], source[index]);
                  index += 2;
                }
              else
                {
                  if (index - length < 5)
                    continue;

                  if (!RE_Compiler::IsHexDigit (source[index + 2]) || !RE_Compiler::IsHexDigit (source[index + 3]))
                    continue;

                  character = RE_Compiler::HexToCharacter (source[index + 3], source[index + 2], source[index + 1], source[index]);
                  index += 4;
                }
              break;

            default:
              character = source[index - 1];
              break;

#if 0
#ifdef ES_FEATURE__ERROR_MESSAGES
              error_string = ES_ERROR ("invalid escape sequence.");
              --index;
#endif /* ES_FEATURE__ERROR_MESSAGES */

              return false;
#endif // 0
            }

          if (!builtin_class_handled)
            builtin_class = BUILTIN_NONE;
        }
#ifdef RE_FEATURE__CHARACTER_CLASS_INTERSECTION
      else if (character == '&' && length - index >= 3 && source[index] == '&' && source[index + 1] == '[')
        {
          unsigned index0 = index + 2;

          RE_Class *iw = OP_NEW_L (RE_Class, (case_insensitive));

          iw->intersect_next = intersect_with;
          intersect_with = iw;

          if (!iw->ConstructL (depth, source, index0, length, extended))
            return false;

          index = index0 + 1;
        }
#endif // RE_FEATURE__CHARACTER_CLASS_INTERSECTION

      if (character == -2)
        range_first = -1;
      else if (range_first == -1)
        {
          RE_SKIP_WHITESPACE ();

          if (index < length)
            {
              int dash = source[index];

              if (dash == '-')
                {
                  range_first = character;
                  ++index;

#ifdef ES_FEATURE__ERROR_MESSAGES
                  range_second_index = index;
#endif /* ES_FEATURE__ERROR_MESSAGES */

                  continue;
                }
            }

          if (character != -2)
            {
              SetCharacter (character);
              builtin_class = BUILTIN_NONE;
            }
        }
      else if (range_first == -2 || range_first > character)
        {
#ifdef ES_FEATURE__ERROR_MESSAGES
          if (range_first == -2 || character == -2)
            {
              error_string = ES_ERROR ("invalid component in range.");

              if (range_first == -2)
                index = range_first_index;
              else
                index = range_second_index;
            }
          else
            {
              error_string = ES_ERROR ("negative range.");
              index = range_first_index;
            }
#endif /* ES_FEATURE__ERROR_MESSAGES */

          return false;
        }
      else
        {
          SetRange (range_first, character);
          builtin_class = BUILTIN_NONE;

          range_first = -1;
        }

      RE_SKIP_WHITESPACE ();
    }

  if (index == length)
    return false;

#ifdef RE_FEATURE__CHARACTER_CLASS_INTERSECTION
  RE_Class **iwp = &intersect_with;

  while (RE_Class *iw = *iwp)
    {
      for (unsigned i = 0; i < BITMAP_ELEMENTS; ++i)
#ifdef RE_COMPACT_CLASS_BITMAP
        bitmap[i] &= iw->bitmap[i];
#else // RE_COMPACT_CLASS_BITMAP
        bitmap[i] &= iw->bitmap[i];
#endif // RE_COMPACT_CLASS_BITMAP

      if (!iw->map)
        {
          /* Discard ranges that only use the bitmap; they are fully
             merged with the main set in the step above. */
          *iwp = iw->intersect_next;
          OP_DELETE(iw);
        }
      else
        iwp = &iw->intersect_next;
    }
#endif // RE_FEATURE__CHARACTER_CLASS_INTERSECTION

  if (case_insensitive)
    {
#ifdef RE_COMPACT_CLASS_BITMAP
      bitmap[3] |= bitmap[2] & 0x7ffffe;
      bitmap[2] |= bitmap[3] & 0x7ffffe;
#else // RE_COMPACT_CLASS_BITMAP
      unsigned b;

      for (b = 'A'; b <= 'Z'; ++b)
        if (bitmap[b])
          bitmap[b + 32] = 1;
        else if (bitmap[b + 32])
          bitmap[b] = 1;
#endif // RE_COMPACT_CLASS_BITMAP

      for (int character = 128; character < 256; ++character)
        if (Match (character))
          if (uni_islower (character))
            SetCharacter (uni_toupper (character));
          else if (uni_isupper (character))
            SetCharacter (uni_tolower (character));
    }

  if (inverted)
    for (unsigned idx = 0; idx < BITMAP_ELEMENTS; ++idx)
#ifdef RE_COMPACT_CLASS_BITMAP
      bitmap[idx] ^= ~0u;
#else // RE_COMPACT_CLASS_BITMAP
      bitmap[idx] = !bitmap[idx];
#endif // RE_COMPACT_CLASS_BITMAP

#undef SetCharacter
#undef SetRange

  ConstructMap (eir);

  return true;
}
示例#11
0
CReconUnit::CReconUnit(ETeam et)
{
  spr_etTeam = et;
  SetCharacter("Recon", et);
}
示例#12
0
ScreenOptionsMaster::ScreenOptionsMaster( const CString &sClassName ):
	ScreenOptions( sClassName )
{
	LOG->Trace("ScreenOptionsMaster::ScreenOptionsMaster(%s)", m_sName.c_str() );

	/* If this file doesn't exist, leave the music alone (eg. ScreenPlayerOptions music sample
	 * left over from ScreenSelectMusic).  If you really want to play no music, add a redir
	 * to _silent. */
	CString MusicPath = THEME->GetPathToS( ssprintf("%s music", m_sName.c_str()), true );
	if( MusicPath != "" )
		SOUND->PlayMusic( MusicPath );

	CStringArray asLineNames;
	split( LINE_NAMES, ",", asLineNames );
	if( asLineNames.empty() )
		RageException::Throw( "%s::LineNames is empty.", m_sName.c_str() );


	CStringArray Flags;
	split( OPTION_MENU_FLAGS, ";", Flags, true );
	InputMode im = INPUTMODE_INDIVIDUAL;
	bool Explanations = false;
	
	unsigned i;
	for( i = 0; i < Flags.size(); ++i )
	{
		CString &flag = Flags[i];
		flag.MakeLower();

		if( flag == "together" )
			im = INPUTMODE_SHARE_CURSOR;
		else if( flag == "explanations" )
			Explanations = true;
		else if( flag == "forceallplayers" )
		{
			FOREACH_PlayerNumber( pn )
				GAMESTATE->m_bSideIsJoined[pn] = true;
			GAMESTATE->m_MasterPlayerNumber = PlayerNumber(0);
		}
		else if( flag == "smnavigation" )
			SetNavigation( NAV_THREE_KEY_MENU );
		else if( flag == "toggle" || flag == "firstchoicegoesdown" )
			SetNavigation( PREFSMAN->m_bArcadeOptionsNavigation? NAV_TOGGLE_THREE_KEY:NAV_TOGGLE_FIVE_KEY );
	}

	m_OptionRowAlloc = new OptionRowData[asLineNames.size()];
	for( i = 0; i < asLineNames.size(); ++i )
	{
		OptionRowData &row = m_OptionRowAlloc[i];
		
		vector<ParsedCommand> vCommands;
		ParseCommands( LINE(asLineNames[i]), vCommands );
		
		if( vCommands.size() < 1 )
			RageException::Throw( "Parse error in %s::Line%i", m_sName.c_str(), i+1 );

		OptionRowHandler hand;
		for( unsigned part = 0; part < vCommands.size(); ++part)
		{
			ParsedCommand& command = vCommands[part];

			HandleParams;

			const CString name = sParam(0);

			if( !name.CompareNoCase("list") )
			{
				SetList( row, hand, sParam(1), row.name );
			}
			else if( !name.CompareNoCase("steps") )
			{
				SetStep( row, hand );
				row.name = "Steps";
			}
			else if( !name.CompareNoCase("conf") )
			{
				SetConf( row, hand, sParam(1), row.name );
			}
			else if( !name.CompareNoCase("characters") )
			{
				SetCharacter( row, hand );
				row.name = "Characters";
			}
			else
				RageException::Throw( "Unexpected type '%s' in %s::Line%i", name.c_str(), m_sName.c_str(), i );

			CheckHandledParams;
		}

		// TRICKY:  Insert a down arrow as the first choice in the row.
		if( m_OptionsNavigation == NAV_TOGGLE_THREE_KEY )
		{
			row.choices.insert( row.choices.begin(), ENTRY_NAME("NextRow") );
			hand.ListEntries.insert( hand.ListEntries.begin(), ModeChoice() );
		}

		OptionRowHandlers.push_back( hand );
	}

	ASSERT( OptionRowHandlers.size() == asLineNames.size() );

	Init( im, m_OptionRowAlloc, asLineNames.size() );
}