示例#1
0
void RenderRect(float x, float y, float width, float height, D3DCOLOR Color)
{
	RenderRect4(x, y , width, height, Color, Color, Color, Color);
}
示例#2
0
void IntroClass::DoIntro(void)
{
	// Hintergrund rendern
	DirectGraphics.SetColorKeyMode();

	int a = (TextOff - 1) / 4;
	if (a < 0) a = 0;
	if (a > 5) a = 5;

	Background[a].RenderSprite(0, 0, 0, 0xFFFFFFFF);

	// nächstes Bild überblenden?
	if ((TextOff - 1) % 4 == 3 &&
		a < 5)
	{
		D3DCOLOR fadecol = D3DCOLOR_RGBA(255, 255, 255, (int)(Counter / 1300.0f * 255.0f));
		Background[a+1].RenderSprite(0, 0, 0, fadecol);
	}

	// Balken unten
	RenderRect4(0, 360, 640, 60, 0x00000000, 0x00000000, 
								 0xFF000000, 0xFF000000);
	RenderRect(0, 420, 640, 60, 0xFF000000);

	// Intro laufen lassen
	switch(Zustand)
	{
		case INTRO_FADEIN :						// Text scrollen
		{
			// Mucke spielen
			if (pSoundManager->InitSuccessfull &&
				FMUSIC_IsPlaying(pSoundManager->its_Songs[MUSIC_INTRO]->SongData) == false)
				pSoundManager->PlaySong(MUSIC_INTRO, false);				

			// und einfaden
			Counter += 10.0f SYNC;

			if (Counter > 255.0f)
			{
				Counter = 0.0f;
				Zustand = INTRO_RUN;
			}
			else
			{
				D3DCOLOR col = D3DCOLOR_RGBA(0, 0, 0, 255-int(Counter));
				RenderRect(0, 0, 640, 480, col);			
			}
		} break;

		case INTRO_FADEOUT :
		{
			// und ausfaden
			Counter -= 5.0f SYNC;

			if (Counter < 0.0f)
			{
				Counter = 0.0f;
				Zustand = INTRO_DONE;
			}

			D3DCOLOR col = D3DCOLOR_RGBA(0, 0, 0, 255-int(Counter));
			RenderRect(0, 0, 640, 480, col);			
			
		} break;

		// Scroller
		case INTRO_RUN:
		{
			Counter += 25.5f SYNC;

			if (Counter > 1300.0f)
			{
				Counter = 0.0f;
				TextOff++;

				if (TextOff > 23)
				{
					EndIntro();
					break;
				}
			}
			
			// Text rendern	
			float xr = Counter;
			if (xr > 700.0f)
				xr = 700.0f;

			DirectGraphics.SetAdditiveMode();

			for (int t = 0; t <= 23; t++)
			{
				D3DCOLOR col;

				col = D3DCOLOR_RGBA(0, 255, 0, 255 - (TextOff - t) * 25);

				if (t <= TextOff &&
					t - TextOff > -10)
				{
					int off = TEXT_INTRO1 + t;

					if (off == TEXT_INTRO1 + 22 &&
						NUMPLAYERS == 2)
						off++;
					else
					if (off >= TEXT_INTRO1 + 23)
						off++;

					pDefaultFont->DrawText(10, (float)(465 + t * 12) - TextOff * 12, TextArray[off], col);

					// Teil des Textes verdecken
					if (t == TextOff)
					{
						DirectGraphics.SetColorKeyMode();
						RenderRect(xr, 464, 640.0f, 17, 0xFF000000);
					}
				}
			}	

			//grüne Rechtecke rendern
			if (TextOff <= 28)
			{
				DirectGraphics.SetAdditiveMode();
				{										
					int l = pDefaultFont->StringLength(TextArray[TEXT_INTRO1 + TextOff], 0) + 28;
					if (xr < l)
					{
						for (int i = 0; i < 5; i++)
						{
							D3DCOLOR col;

							switch(i)
							{
								case 0: col = D3DCOLOR_RGBA(255, 255, 255, 255); break;
								case 1: col = D3DCOLOR_RGBA(0, 255, 0, 255); break;
								case 2: col = D3DCOLOR_RGBA(0, 180, 0, 255); break;
								case 3: col = D3DCOLOR_RGBA(0, 90, 0, 255); break;
								case 4: col = D3DCOLOR_RGBA(0, 50, 0, 255); break;
							}

							RenderRect(xr - i * 12 - 12, 464, 12, 12, col);
						}
					}
					else
					{
						xr = (float)l;

						// blinken lassen
						if ((int)(Counter / 100.0f) % 2 == 0)
							RenderRect(xr - 12, 464, 12, 12, 0xFFFFFFFF);
					}
				}
			}
		}
		break;

		default : break;

	} // switch	
}
示例#3
0
void GegnerTheWall::DoDraw(void)
{
    if (PlayerAbstand() > 800)
        return;

    D3DCOLOR Color, col;
    int toff;

    if (AlreadyDrawn == false)
    {
        toff = int(sin(DoorOffset) * 100);
        col = D3DCOLOR_RGBA(toff*2 + 50,
                            toff*2 + 50,
                            toff*2 + 50, 255);

        int	Wert = 255-(int(DamageTaken));

        if (DirectGraphics.BlendMode == ADDITIV_MODE)
            Color = D3DCOLOR_RGBA(Wert, 0, 0, 255);
        else
            Color = 0xFFFFFFFF;

        // Maschine rechts
        pGegnerGrafix[GegnerArt]->RenderSprite(xPos - (float)pTileEngine->XOffset,
                                               yPos - (float)pTileEngine->YOffset,
                                               0xFFFFFFFF);

        // Vorderteil
        Vorne.RenderSprite(xPos - (float)pTileEngine->XOffset + VorneX + 3.0f,
                           yPos - (float)pTileEngine->YOffset + VorneY + 148.0f,
                           0xFFFFFFFF);
    }

    // Skeletorkopf rendern
    if (Value1 == 1)
    {
        Brain.SetRect(0, 123, 27, 157);
        if (DirectGraphics.BlendMode == ADDITIV_MODE)
            DirectGraphics.SetAdditiveMode();
        Brain.RenderSprite(xPos - (float)pTileEngine ->XOffset + 3  + VorneX,
                           yPos - (float)pTileEngine->YOffset + 228 + VorneY, Color);
    }

    if (AlreadyDrawn == true)
        return;

    // Kringel im Hintergrund
    Kringel[1].RenderSprite(xPos - (float)pTileEngine->XOffset + TunnelOffx + 38,
                            yPos - (float)pTileEngine->YOffset + TunnelOffY - 14, (int)(KringelWinkel / 3.0f ) % 5,
                            col);

    // Herz rendern
    if (Handlung != GEGNER_EXPLODIEREN)
    {
        Brain.RenderSprite(xPos - (float)pTileEngine ->XOffset + TunnelOffx + 116,
                           yPos - (float)pTileEngine->YOffset + TunnelOffY + 59, HeartAnim,
                           col);

        // Suppe rendern
        DirectGraphics.SetAdditiveMode();
        D3DCOLOR supcol1 = D3DCOLOR_RGBA(150, 0, 0, (int)(toff*1.5f));
        D3DCOLOR supcol2 = D3DCOLOR_RGBA(150, 0, 0, (int)(toff*1.5f));
        int start = int((4000 - Energy * 0.75f) / 4000.0f * 42);

        RenderRect4(xPos - (float)pTileEngine ->XOffset + TunnelOffx + 117,
                    yPos - (float)pTileEngine->YOffset + TunnelOffY + 59 + start, 37, (float)(42 - start),
                    supcol1, supcol1, supcol2, supcol2);

        DirectGraphics.SetColorKeyMode();
    }

    // Röhrenaufhängung rendern
    Brain.SetRect(76, 0, 129, 157);
    Brain.RenderSprite(xPos - (float)pTileEngine ->XOffset + TunnelOffx + 110,
                       yPos - (float)pTileEngine->YOffset + TunnelOffY + 2, col);

    // abdeckenden Kringel rendern
    Kringel[0].RenderSpriteRotated(xPos - (float)pTileEngine->XOffset + TunnelOffx + 37,
                                   yPos - (float)pTileEngine->YOffset + TunnelOffY - 16, 360.0f - KringelWinkel, 0,
                                   col);

    // Türen

    // Tür links
    Tuer.SetRect(toff, 0, 138, 185);

    // Schatten
    Tuer.RenderSprite(xPos - (float)pTileEngine ->XOffset + TunnelOffx  + 20,
                      yPos - (float)pTileEngine->YOffset + TunnelOffY - 10, 0x80000000);

    Tuer.RenderSprite(xPos - (float)pTileEngine ->XOffset + TunnelOffx  + 10,
                      yPos - (float)pTileEngine->YOffset + TunnelOffY - 10, -1,
                      0xFF333333, col, 0xFF333333, col);

    // Tür rechts
    Tuer.SetRect(138, 0, 266 - toff, 185);

    Tuer.RenderSprite(xPos - (float)pTileEngine ->XOffset + TunnelOffx + 128 + toff,
                      yPos - (float)pTileEngine->YOffset + TunnelOffY - 10, -1,
                      col, 0xFF333333, col, 0xFF333333);

    // rahmen aussenrum
    Rahmen.RenderSprite(xPos - (float)pTileEngine ->XOffset + TunnelOffx - 8,
                        yPos - (float)pTileEngine->YOffset + TunnelOffY - 26, 0xFFA0A0A0);

    AlreadyDrawn = true;
}