Example #1
0
void EInfo::Init(int level)
{
    EItems4D::Init();
    infoText.clear();

    infoText.push_back( glRes.Build3DText((unsigned char*)" 一二三四五六七八九") );

    //a 1-2
    infoText.push_back( glRes.Build3DText((unsigned char*)"WELCOME!") );
    infoText.push_back( glRes.Build3DText((unsigned char*)"一个不正常的迷宫") );
    //b
    infoText.push_back( glRes.Build3DText((unsigned char*)"一个现实世界中") );
    infoText.push_back( glRes.Build3DText((unsigned char*)"不可能存在的迷宫") );
    //c 5
    infoText.push_back( glRes.Build3DText((unsigned char*)"用右键平移") );
    //d
    infoText.push_back( glRes.Build3DText((unsigned char*)"在角落平移") );
    infoText.push_back( glRes.Build3DText((unsigned char*)"你将发现那个秘密") );
    //e 8-11
    infoText.push_back( glRes.Build3DText((unsigned char*)"有时你会发现") );
    infoText.push_back( glRes.Build3DText((unsigned char*)"你会突然跳出这世界") );
    infoText.push_back( glRes.Build3DText((unsigned char*)"发现原来,曾经的一切") );
    infoText.push_back( glRes.Build3DText((unsigned char*)"不过就这么大点地方") );
    //b
//     infoText.push_back( glRes.Build3DText((unsigned char*)"它在现实世界中永远无法造出") );

    PlaceItem('a',3,2,0,'A');
    PlaceItem('b',1,2,0,'A');
    PlaceItem('c',0,3,0,'A');
    PlaceItem('d',0,1,0,'A');
    PlaceItem('e',2,3,0,'T');
}
Example #2
0
qboolean Item::Drop( void )
{
	if ( !owner )
	{
		return false;
	}
	
	setOrigin( owner->origin + Vector( "0 0 40" ) );
	
	// drop the item
	PlaceItem();
	velocity = owner->velocity * 0.5f + Vector( G_CRandom( 50.0f ), G_CRandom( 50.0f ), 100.0f );
	setAngles( owner->angles );
	avelocity = Vector( 0.0f, G_CRandom( 360.0f ), 0.0f );
	
	trigger_time = level.time + 1.0f;
	
	if ( owner->isClient() )
	{
		spawnflags |= DROPPED_PLAYER_ITEM;
	}
	else
	{
		spawnflags |= DROPPED_ITEM;
	}
	
	// Remove this from the owner's item list
	owner->RemoveItem( this );
	owner = NULL;
	
	return true;
}
Example #3
0
bool psSlotManager::HandleEvent( iEvent& ev )
{
    if(isDragging)
    {
        if(ev.Name == MouseMove)
        {
            if(isPlacing)
            {
                // Update item position.
                UpdateItem();
            }
        }
        else if(ev.Name == MouseDown)
        {
          uint button = csMouseEventHelper::GetButton(&ev);
          
          if(button == 0) // Left
          {
              if(isPlacing)
              {
                  // Drop the item at the current position.
                  if(isRotating)
                  {
                      DropItem();
                      return true;
                  }

                  // Else begin rotate...
                  isRotating = true;
                  basePoint = PawsManager::GetSingleton().GetMouse()->GetPosition();
                  psengine->GetSceneManipulator()->SaveCoordinates(csVector2(basePoint.x, basePoint.y));
                  return false;
              }

              // Else place...
              PlaceItem();
          }
          else
          {
              CancelDrag();

              // Show the inventory window, remove outline mesh etc. if we're placing.
              if(isPlacing)
              {
                  PawsManager::GetSingleton().GetMainWidget()->FindWidget("InventoryWindow")->Show();

                  // Remove outline mesh.
                  psengine->GetSceneManipulator()->RemoveSelected();

                  isPlacing = false;
                  isRotating = false;
              }
          }
        }
    }

    return false;
}
Example #4
0
/*
============
DropToFloor

plants the object on the floor
============
*/
void Item::DropToFloor( Event * )
{
	str fullname;
	Vector save;
	
	PlaceItem();
	
	addOrigin( Vector(0, 0, 1) );
	
	save = origin;
	
	if ( gravity > 0.0f )
	{
		if ( !droptofloor( 8192.0f ) )
		{
			gi.WDPrintf( "%s (%d) stuck in world at '%5.1f %5.1f %5.1f'\n",
				getClassID(), entnum, origin.x, origin.y, origin.z );
			setOrigin( save );
			setMoveType( MOVETYPE_NONE );
		}
		else
		{
			setMoveType( MOVETYPE_NONE );
		}
	}
	
	//
	// if the our global variable doesn't exist, lets zero it out
	//
	fullname = str( "playeritem_" ) + getName();
	if ( !gameVars.VariableExists( fullname.c_str() ) )
	{
		gameVars.SetVariable( fullname.c_str(), 0 );
	}
	
	if ( !levelVars.VariableExists( fullname.c_str() ) )
	{
		levelVars.SetVariable( fullname.c_str(), 0 );
	}

	if ( multiplayerManager.inMultiplayer() && gi.Anim_NumForName( edict->s.modelindex, "idle_onground" ) >= 0 )
	{
		animate->RandomAnimate( "idle_onground" );
		edict->s.eType = ET_MODELANIM;
	}
}
Example #5
0
void EItem4D::LoadData(int level){
	if (data) free(data);
	int dataSize = maze.size.Capacity();
	data = (char*)malloc( dataSize );
	if (!data) exit(0);

	memset(data,'\0',dataSize);
	PlaceItem('{',maze.start);
	PlaceItem('}',maze.end);

	if (level==1)
	{
		PlaceItem('a',1,2,0,'A');
		PlaceItem('1',4,2,0,'F');
		PlaceItem('2',4,2,0,'I');
		PlaceItem('3',2,1,0,'H');
	}
	else if (level==2)
	{
		PlaceItem('4',2,2,0,'G');
		PlaceItem('Z',2,3,0,'T');
	}
	else if (level==3)
	{
		PlaceItem('Y',3,4,0,'A');
		PlaceItem('b',2,2,6,'A');
		PlaceItem('c',2,2,7,'A');
		PlaceItem('d',0,0,7,'A');
	}
	else if (level==4)
	{
		PlaceItem('b',3,2,2,'A');
		PlaceItem('c',0,2,0,'A');
		PlaceItem('d',4,4,4,'A');
	}
	else if (level==5)
	{
		PlaceItem('a',4,5,3,'A');
		PlaceItem('b',2,1,5,'A');
/*	//原立柱关的物品
		PlaceItem('a',1,2,0,'A');
		PlaceItem('b',5,3,0,'I');
		PlaceItem('c',5,1,0,'F');
		PlaceItem('d',3,1,0,'H');
		PlaceItem('e',1,1,0,'H');*/
	}

}
bool psSlotManager::HandleEvent( iEvent& ev )
{
    if(isDragging)
    {
        int button = csMouseEventHelper::GetButton(&ev);
        if(ev.Name == MouseMove)
        {
            if(isPlacing)
            {
                // Update item position.
                UpdateItem();
            }
        }
        else if(ev.Name == MouseDown)
        {
            if(button == csmbLeft) // Left
            {
                if(isPlacing)
                {
                    // Drop the item at the current position.
                    DropItem(!(csMouseEventHelper::GetModifiers(&ev) & CSMASK_SHIFT));
                    return true;
                }
                else
                {
                    PlaceItem();
                }
            }
            else if(button == csmbRight) // right
            {
                if(!isRotating)
                {
                    basePoint = PawsManager::GetSingleton().GetMouse()->GetPosition();
                    isRotating = true;
                    if(csMouseEventHelper::GetModifiers(&ev) & CSMASK_SHIFT)
                    {
                        psengine->GetSceneManipulator()->SetRotation(PS_MANIPULATE_PITCH,PS_MANIPULATE_YAW);
                    }
                    else
                    {
                        psengine->GetSceneManipulator()->SetRotation(PS_MANIPULATE_ROLL,PS_MANIPULATE_NONE);
                    }
                    return true;
                }
            }
            else
            {
                CancelDrag();
            }
        }
        else if(ev.Name == MouseUp)
        {
            if(button == csmbRight) // right
            {
                if(isRotating)
                {
                    //PawsManager::GetSingleton().GetMouse()->SetPosition(basePoint.x, basePoint.y);
                    psengine->GetG2D()->SetMousePosition(basePoint.x, basePoint.y);
                    psengine->GetSceneManipulator()->SetPosition(csVector2(basePoint.x, basePoint.y));
                    isRotating = false;
                    return true;
                }
            }
        }
        /*else if(ev.Name == KeyDown)
        {
        }
        else if(ev.Name == KeyUp)
        {
        }*/
    }

    return false;
}
/* Handles the selection of tools, menu, and popup menu commands.
 */
void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
    int id = event.GetId();
    int idx;
    wxString msg;
    WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
    WORKSHEET_DATAITEM* item = NULL;
    wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
    cmd.SetEventObject( this );

    switch( id )
    {
    case ID_NO_TOOL_SELECTED:
        SetNoToolSelected();
        break;

    case ID_MENU_ZOOM_SELECTION:
    case ID_ZOOM_SELECTION:
        // This tool is located on the main toolbar: switch it on or off on click
        if( GetToolId() != ID_ZOOM_SELECTION )
            SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
        else
            SetNoToolSelected();
        break;

    case ID_SELECT_PAGE_NUMBER:
        m_canvas->Refresh();
        break;

    case ID_SHEET_SET:
        {
        DIALOG_PAGES_SETTINGS dlg( this );
        dlg.SetWksFileName( GetCurrFileName() );
        dlg.EnableWksFileNamePicker( false );
        dlg.ShowModal();

        cmd.SetId( ID_ZOOM_PAGE );
        wxPostEvent( this, cmd );
        }
        break;

    case ID_POPUP_CANCEL_CURRENT_COMMAND:
        if( m_canvas->IsMouseCaptured() )
        {
            m_canvas->EndMouseCapture();
            SetToolID( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString );
        }
        else
        {
            SetNoToolSelected();
        }
        break;

    case ID_POPUP_DESIGN_TREE_ITEM_DELETE:
    case ID_POPUP_ITEM_DELETE:
    case wxID_CUT:
        // Delete item, and select the previous item
        item = m_treePagelayout->GetPageLayoutSelectedItem();

        if( item == NULL )
            break;

        SaveCopyInUndoList();
        idx = pglayout.GetItemIndex( item );
        pglayout.Remove( item );
        RebuildDesignTree();

        if( id == ID_POPUP_DESIGN_TREE_ITEM_DELETE )
        {
            item = pglayout.GetItem( (unsigned) (idx-1) );

            if( item )
                m_treePagelayout->SelectCell( item );
        }

        item = NULL;
        OnModify();
        m_canvas->Refresh();
        break;

    case ID_POPUP_ITEM_ADD_LINE:
        SaveCopyInUndoList();
        idx =  m_treePagelayout->GetSelectedItemIndex();
        item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_SEGMENT, idx );

        if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
        {
            RemoveLastCommandInUndoList();
            pglayout.Remove( item );
            RebuildDesignTree();
            item = NULL;
        }
        else
        {
            // Put the new item in move mode, after putting the cursor
            // on the start point:
            wxPoint position = item->GetStartPosUi();
            SetCrossHairPosition( position, false );
            position = GetCrossHairPosition();

            if( m_canvas->IsPointOnDisplay( position ) )
                m_canvas->MoveCursorToCrossHair();
            else
                RedrawScreen( position, true );

            item->SetFlags( NEW_ITEM );
            MoveItem( item );
        }
        break;

    case ID_POPUP_ITEM_ADD_RECT:
        SaveCopyInUndoList();
        idx =  m_treePagelayout->GetSelectedItemIndex();
        item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_RECT, idx );

        if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
        {
            RemoveLastCommandInUndoList();
            pglayout.Remove( item );
            RebuildDesignTree();
            item = NULL;
        }
        else
        {
            // Put the new item in move mode, after putting the cursor
            // on the start point:
            wxPoint position = item->GetStartPosUi();
            SetCrossHairPosition( position, false );
            position = GetCrossHairPosition();

            if( m_canvas->IsPointOnDisplay( position ) )
                m_canvas->MoveCursorToCrossHair();
            else
                RedrawScreen( position, true );

            item->SetFlags( NEW_ITEM );
            MoveItem( item );
        }
        break;

    case ID_POPUP_ITEM_ADD_TEXT:
        SaveCopyInUndoList();
        idx =  m_treePagelayout->GetSelectedItemIndex();
        item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_TEXT, idx );
        if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
        {
            RemoveLastCommandInUndoList();
            pglayout.Remove( item );
            RebuildDesignTree();
            item = NULL;
        }
        else
        {
            // Put the new text in move mode:
            item->SetFlags( NEW_ITEM | LOCATE_STARTPOINT );
            MoveItem( item );
        }
        break;

    case ID_POPUP_ITEM_ADD_BITMAP:
        SaveCopyInUndoList();
        idx =  m_treePagelayout->GetSelectedItemIndex();
        item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_BITMAP, idx );
        if( item && InvokeDialogNewItem( this, item ) == wxID_CANCEL )
        {
            RemoveLastCommandInUndoList();
            pglayout.Remove( item );
            RebuildDesignTree();
            item = NULL;
        }
        if( item )
        {
            // Put the new text in move mode:
            item->SetFlags( NEW_ITEM | LOCATE_STARTPOINT );
            MoveItem( item );
        }
        break;

    case ID_POPUP_ITEM_APPEND_PAGE_LAYOUT:
        cmd.SetId( ID_APPEND_DESCR_FILE );
        wxPostEvent( this, cmd );
        break;

    case ID_POPUP_ITEM_PLACE:
        item = GetScreen()->GetCurItem();
        PlaceItem( item );
        break;

    case ID_POPUP_ITEM_PLACE_CANCEL:
        if(  m_canvas->IsMouseCaptured() )
             m_canvas->EndMouseCapture();
        break;

    case ID_POPUP_ITEM_MOVE_START_POINT:
        item = m_treePagelayout->GetPageLayoutSelectedItem();
        // Ensure flags are properly set
        item->ClearFlags( LOCATE_ENDPOINT );
        item->SetFlags( LOCATE_STARTPOINT );
        MoveItem( item );
        break;

    case ID_POPUP_ITEM_MOVE_END_POINT:
        item = m_treePagelayout->GetPageLayoutSelectedItem();
        // Ensure flags are properly set
        item->ClearFlags( LOCATE_STARTPOINT );
        item->SetFlags( LOCATE_ENDPOINT );
        MoveItem( item );
        break;

    case ID_POPUP_ITEM_MOVE:
        item = m_treePagelayout->GetPageLayoutSelectedItem();
        item->ClearFlags( LOCATE_ENDPOINT|LOCATE_STARTPOINT );
        MoveItem( item );
        break;

    default:
        wxMessageBox( wxT( "PL_EDITOR_FRAME::Process_Special_Functions error" ) );
        break;
    }

    if( item )
    {
        OnModify();
        m_propertiesPagelayout->CopyPrmsFromItemToPanel( item );
        m_treePagelayout->SelectCell( item );
    }

}