//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tEditExpandSideBar::SetToNormal( bool animate ) { if ( ExpandedView() ) { Collapse( animate ); } if ( Hidden() ) { if ( animate ) { SlideIn(); } else { MoveIn(); } UpdateExpandCollapseItem(); } }
// // Draw Weapon Menu // int CHudAmmo::DrawWList(float flTime) { // int r,g,b,x,y,a,i; int baseX, baseY, x,y; bool blFakeActive = false; // Check if sliding is finished if(m_blSliding) { if(m_flSlideTime + SLIDETIME < gHUD.m_flTime) { m_blSliding = false; m_blSlideIn = false; m_flSlideTime = 0; } } // "Fake" active weapon so we can slide the weapon bar out with the correct information if ( !gpActiveSel ) { // start sliding if(m_blPrevStatus) { m_blPrevStatus = false; SlideIn(); blFakeActive = true; gpActiveSel = gpLastSel; if(!gpActiveSel) return 0; } else if(m_blSliding) { blFakeActive = true; gpActiveSel = gpLastSel; if(!gpActiveSel) return 0; } else { m_blPrevStatus = false; return 0; } } else { if(!m_blPrevStatus) { SlideOut(); } m_blPrevStatus = true; } int iActiveSlot; if ( gpActiveSel == (WEAPON *)1 ) iActiveSlot = -1; // current slot has no weapons else iActiveSlot = gpActiveSel->iSlot; baseX=x=0; baseY=y=GetYBase(m_iweapcenterHeight); // Ensure that there are available choices in the active slot if ( iActiveSlot > 0 ) { if ( !gWR.GetFirstPos( iActiveSlot ) ) { gpActiveSel = (WEAPON *)1; iActiveSlot = -1; } } // Draw left bar edge SPR_Set(gHUD.GetSprite(m_HUD_wpleft), 255, 255, 255 ); SPR_DrawHoles(0,x,y, &gHUD.GetSpriteRect(m_HUD_wpleft)); // Move over drawing position to the end of the left bar x+=m_iweapedgeWidth; // Draw all of the buckets for (int i = 0; i < MAX_WEAPON_SLOTS; i++) { // Set bucket rect wrect_t bucketrect; bucketrect.top = 0; bucketrect.left = 0; bucketrect.bottom = BUCKET_HEIGHT; bucketrect.right = BUCKET_WIDTH; // If this is the active slot, draw the bigger pictures, WEAPON *p = gWR.GetFirstPos( i ); /* int iWidth = BUCKET_WIDTH; int iHeight = BUCKET_HEIGHT;*/ if ( p ) {/* iWidth = p->rcActive.right - p->rcActive.left; iHeight = p->rcActive.bottom - p->rcActive.top;*/ } for ( int iPos = 0; iPos < MAX_WEAPON_POSITIONS; iPos++ ) { p = gWR.GetWeaponSlot( i, iPos ); if ( !p || !p->iId ) continue; // Draw bucket SPR_Set(gHUD.GetSprite(m_HUD_wpcenter), 255, 255, 255 ); SPR_DrawHoles(0, x, y, &gHUD.GetSpriteRect(m_HUD_wpcenter)); // Active weapon if ( gpActiveSel == p ) { SPR_Set(p->hActive, 255, 255, 255 ); SPR_Draw(0, x+OFFSETBUCKET_X, y+OFFSETBUCKET_Y, &bucketrect); } // Unactive weapon else { SPR_Set(p->hInactive, 255, 255, 255 ); SPR_Draw(0, x+OFFSETBUCKET_X, y+OFFSETBUCKET_Y, &bucketrect); } x+=m_iweapcenterWidth; } } // Draw right bar edge SPR_Set(gHUD.GetSprite(m_HUD_wpright), 255, 255, 255 ); SPR_DrawHoles(0,x,y, &gHUD.GetSpriteRect(m_HUD_wpright)); // Set active back to NULL if(blFakeActive) { gpActiveSel = NULL; } // Redone by Pcjoe /* x = 10; //!!! y = 10; //!!! // Ensure that there are available choices in the active slot if ( iActiveSlot > 0 ) { if ( !gWR.GetFirstPos( iActiveSlot ) ) { gpActiveSel = (WEAPON *)1; iActiveSlot = -1; } } // Draw top line for ( i = 0; i < MAX_WEAPON_SLOTS; i++ ) { int iWidth; UnpackRGB(r,g,b, RGB_YELLOWISH); if ( iActiveSlot == i ) a = 255; else a = 192; ScaleColors(r, g, b, 255); SPR_Set(gHUD.GetSprite(m_HUD_bucket0 + i), r, g, b ); // make active slot wide enough to accomodate gun pictures if ( i == iActiveSlot ) { WEAPON *p = gWR.GetFirstPos(iActiveSlot); if ( p ) iWidth = p->rcActive.right - p->rcActive.left; else iWidth = giBucketWidth; } else iWidth = giBucketWidth; SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_bucket0 + i)); x += iWidth + 5; } a = 128; //!!! x = 10; // Draw all of the buckets for (i = 0; i < MAX_WEAPON_SLOTS; i++) { y = giBucketHeight + 10; // If this is the active slot, draw the bigger pictures, // otherwise just draw boxes if ( i == iActiveSlot ) { WEAPON *p = gWR.GetFirstPos( i ); int iWidth = giBucketWidth; if ( p ) iWidth = p->rcActive.right - p->rcActive.left; for ( int iPos = 0; iPos < MAX_WEAPON_POSITIONS; iPos++ ) { p = gWR.GetWeaponSlot( i, iPos ); if ( !p || !p->iId ) continue; UnpackRGB( r,g,b, RGB_YELLOWISH ); // if active, then we must have ammo. if ( gpActiveSel == p ) { SPR_Set(p->hActive, r, g, b ); SPR_DrawAdditive(0, x, y, &p->rcActive); SPR_Set(gHUD.GetSprite(m_HUD_selection), r, g, b ); SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_selection)); } else { // Draw Weapon if Red if no ammo if ( gWR.HasAmmo(p) ) ScaleColors(r, g, b, 192); else { UnpackRGB(r,g,b, RGB_REDISH); ScaleColors(r, g, b, 128); } SPR_Set( p->hInactive, r, g, b ); SPR_DrawAdditive( 0, x, y, &p->rcInactive ); } // Draw Ammo Bar DrawAmmoBar(p, x + giABWidth/2, y, giABWidth, giABHeight); y += p->rcActive.bottom - p->rcActive.top + 5; } x += iWidth + 5; } else { // Draw Row of weapons. UnpackRGB(r,g,b, RGB_YELLOWISH); for ( int iPos = 0; iPos < MAX_WEAPON_POSITIONS; iPos++ ) { WEAPON *p = gWR.GetWeaponSlot( i, iPos ); if ( !p || !p->iId ) continue; if ( gWR.HasAmmo(p) ) { UnpackRGB(r,g,b, RGB_YELLOWISH); a = 128; } else { UnpackRGB(r,g,b, RGB_REDISH); a = 96; } FillRGBA( x, y, giBucketWidth, giBucketHeight, r, g, b, a ); y += giBucketHeight + 5; } x += giBucketWidth + 5; } }*/ return 1; }