#include #include #include #include #include #include //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ /////////////////// Otro tipo de fondo: LLuvia de estrellas typedef struct { int Ex, Ey, Ez; char Ecolor; } CAMPO_de_ESTRELLAS; CAMPO_de_ESTRELLAS *Cestrellas, *o; void Actualiza(CAMPO_de_ESTRELLAS *Cest); void Star3d(CAMPO_de_ESTRELLAS *Cest); void pon_estrella(CAMPO_de_ESTRELLAS *Cest); void llena_campo(CAMPO_de_ESTRELLAS *Cest); void deinit_star(void); void init_star(void); //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ // Escribe un caracter en (x,y) -> Color|Fondo en VText 0x7900 #define WriteChar50( x, y, caracter, Col, Fon, VText ) VText[80*y + x] = (((unsigned)caracter)&0x00FF) | (((unsigned)( (Fon<<4)+Col )<<8)&0xFF00); /* ( (Fon<<4)+Col ) ( ( (int)( (char)Fon << 4) + Col )<< 8 ) 7 6 5 4 º 3 2 1 0 ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ×ÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ¿ ³ B ³ b ³ b ³ b º f ³ f ³ f ³ f ³ ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄ×ÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÙ º In this 8-bit newattr parameter, þ ffff = 4-bit foreground color (0 to 15) þ bbb = 3-bit background color (0 to 7) þ B = blink-enable bit */ // Proyecto para mostrar cosas en modo texto: 80x50 // Preparamos un buffer virtual a pantalla: 80x50*2 bytes/punto = 8000 bytes int *textoVirtual; int XSinMov[256], YSinMov[256]; int TSin[360+90]; void RellenaTablas(void) { float angle; angle = 0; while( angle < 256 ) { XSinMov[angle] = YSinMov[angle] = (int)( sin( (2*M_PI*angle*1.4)/360 ) * 360) / (2*M_PI); YSinMov[angle] = 0; angle+=1; }; angle = 0; while( angle < (360+90) ) { TSin[angle] = (int)(sin( (2*M_PI*angle)/360 ) * 360 / (2*M_PI) ); angle+=1; }; } char PRIMARIO8 = YELLOW; char SECUNDARIO1 = RED; void Put( int x, int y, unsigned char c) { if ( x < 0 || x >= 80 ) return; if ( y < 0 || y >= 50 ) return; WriteChar50( x, y, '±', (c==0 ? 0 : PRIMARIO8), SECUNDARIO1, textoVirtual ); }; //#define RADIO 255 // Radio de partida #define RADIO 255 #define SALTOS_ANCHOS 7 //#define SALTOS_PROFUNDOS 8 // Grado de torcion #define SALTOS_PROFUNDOS 8 //#define SALTOS_ANCHOS 7 // Saltos de radio #define BLOQUEO_RADIO 1 #define INCREMENTAL 1 //#define PROFUNDIDAD_TUNEL 35 #define PROFUNDIDAD_TUNEL 35 #define FACTOR_SERPIENTE 0.015F //#define TODO_BLANCO //#define TODO_GRIS int PERFECCION_CIRCULO = 8; // Circulo con impresi¢n de giro ( MEJORA POR JD ) void Circulo( int x, int y, int radio, int giro, int Color ) { int angle; for ( angle = 0; angle < 360; angle+=PERFECCION_CIRCULO ) Put( x + (radio*FACTOR_SERPIENTE*TSin[ (giro + angle)%360 + 90 ]), y + (radio*FACTOR_SERPIENTE*TSin[ (giro+angle)%360 ]), angle >= 0 && angle <= 50 ? (Color-PROFUNDIDAD_TUNEL) : Color ); }; // Circulo con impresi¢n de giro ( MEJORA POR JD ) void CirculoB( int x, int y, int radio, int giro ) { int angle; for ( angle = 0; angle < 360; angle+=PERFECCION_CIRCULO ) Put( x + (radio*FACTOR_SERPIENTE*TSin[ (giro + angle)%360 + 90 ]), y + (radio*FACTOR_SERPIENTE*TSin[ (giro+angle)%360 ]), 0 ); }; void TunelEstrellas(void) { int depth, Color; static unsigned char ZMov = 0; static int GiroAngular = 0; unsigned char Movimiento = ZMov; static Subidon = 255; static Velocidad = 0; // Controles de giro por JD: // SUAVE ZMov // DURO Movimiento int OGiroAngular = GiroAngular; GiroAngular = ( GiroAngular++ ) % 360; ZMov ++; Movimiento = ZMov; Color = 255-PROFUNDIDAD_TUNEL; // Color = 255; Velocidad++; if ( Velocidad == 5 ) { Velocidad = 0; // Subidon --; if ( Subidon < 255-PROFUNDIDAD_TUNEL ) Subidon = 255; Subidon = (Subidon++)%PROFUNDIDAD_TUNEL; } int Retorcido = 0; for ( depth=0; depth=0; depth-=SALTOS_ANCHOS*INCREMENTAL, Movimiento+=SALTOS_PROFUNDOS, Color-- ) { Retorcido+=15; /* OGiroAngular = GiroAngular; GiroAngular = ( GiroAngular++ ) % 360; */ // Borra el anterior CirculoB( XSinMov[(unsigned char)(Movimiento-1)] + 40, YSinMov[(unsigned char)(Movimiento-1)] + 25, RADIO - depth*BLOQUEO_RADIO, OGiroAngular + 0*Movimiento + Retorcido ); Subidon = (Subidon++)%PROFUNDIDAD_TUNEL; // Dibuja el nuevo circulo // Circulo( XSinMov[Movimiento] + 160, YSinMov[Movimiento] + 100, RADIO - depth*BLOQUEO_RADIO, GiroAngular + 0*Movimiento, (Subidon >= Color && Subidon <= Color + 2 ) ? 1: Color ); Circulo( XSinMov[Movimiento] + 40, YSinMov[Movimiento] + 25, RADIO - depth*BLOQUEO_RADIO, GiroAngular + 0*Movimiento + Retorcido, Subidon%6 == 0 || Subidon%6 == 1 ? 1+Subidon : Color); } delay(10); } // Escribe un caracter en (x,y) -> Color|Fondo en VText 0x7900 #define WriteChar50( x, y, caracter, Col, Fon, VText ) VText[80*y + x] = (((unsigned)caracter)&0x00FF) | (((unsigned)( (Fon<<4)+Col )<<8)&0xFF00); class TextoAnimado { private: int *pPlanoVirtual; int *sPlanoVirtual; int *tPlanoVirtual; public: TextoAnimado(void); ~TextoAnimado(void){ delete [] pPlanoVirtual; delete [] sPlanoVirtual; delete [] tPlanoVirtual; }; void locateText( int x, int y, unsigned char *texto, char color, char fondo ); void VuelcaPantallas(void); void BorraTodo(void) { memset( MK_FP( 0xB800, 0 ), 0, 8000 ); memset( tPlanoVirtual, 0, 8000 ); memset( pPlanoVirtual, 0, 8000 ); memset( sPlanoVirtual, 0, 8000 ); }; int *pPlano(void){ return pPlanoVirtual; }; int *sPlano(void){ return sPlanoVirtual; }; }; void TextoAnimado::locateText( int x, int y, unsigned char *texto, char color, char fondo ) { while( *texto != '\0' ) { if ( (*texto) != (unsigned char)'ú' ) { WriteChar50( x++, y, *(texto++), color, fondo, pPlanoVirtual ) } else { WriteChar50( x++, y, 0, 0, 0, pPlanoVirtual ) texto++; } } } TextoAnimado::TextoAnimado(void) { if ( ( pPlanoVirtual = new int [4000] ) == NULL ) { pPlanoVirtual = sPlanoVirtual = tPlanoVirtual = (int *)MK_FP( 0xB800, 0 ); } else if ( ( sPlanoVirtual = new int [4000] ) == NULL ) { sPlanoVirtual = tPlanoVirtual = (int *)MK_FP( 0xB800, 0 ); } else if ( ( tPlanoVirtual = new int [4000] ) == NULL ) tPlanoVirtual = (int *)MK_FP( 0xB800, 0 ); } void TextoAnimado::VuelcaPantallas(void) { int count = 3999;//4000; int * dest, * scr; // Volcamos el segundo plano, ENTERO memcpy( tPlanoVirtual, sPlanoVirtual, 8000 ); // Volcamos el primer plano, pero cuidado caracter ú == transparente dest = tPlanoVirtual; scr = pPlanoVirtual; while( count-- ) { if ( *scr ) { *(dest++) = *(scr++); } else { scr++; dest++; } }; memcpy( MK_FP( 0xB800, 0 ), tPlanoVirtual, 8000 ); } TextoAnimado prueba1; //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ #include #include #include #include #include typedef struct { int x, y; // Posicion en la pantalla char Direc[80]; // Directorio donde localizarlo char Passw[10]; // Password } DATOS_CD; DATOS_CD ArbolActual[] = { { 2, 3, "\\arcade\\ALIEN.RAR", "neila" }, { 2, 4, "\\arcade\\BLAM.RAR", "malb" }, { 2, 5, "\\arcade\\BUBBLE.RAR", "elbbub" }, { 2, 6, "\\arcade\\ERADICAT.RAR", "tacidare" }, { 2, 7, "\\arcade\\SYNDICA2.RAR", "2acidnys" }, { 2, 8, "\\arcade\\TOMBRAID.RAR", "diarbmot" }, { 2, 12, "\\deportiv\\AIRBORNE.RAR", "enrobria" }, { 2, 13, "\\deportiv\\RLA.RAR", "lra" }, { 2, 14, "\\deportiv\\FIFA97.RAR", "79afif" }, { 2, 15, "\\deportiv\\FUTBOL5.RAR", "5lobtuf" }, { 2, 16, "\\deportiv\\SPACEJAM.RAR", "majecaps" }, {47, 3, "\\estrateg\\BC.RAR", "cb" }, {47, 4, "\\estrateg\\DEADLY.RAR", "yldaed" }, {47, 5, "\\estrateg\\REICH.RAR", "hcier" }, {47, 6, "\\estrateg\\RIFLES.RAR", "selfir" }, {47, 7, "\\estrateg\\HARPOON2.RAR", "2nooprah" }, {47, 8, "\\estrateg\\REDALERT.RAR", "trelader" }, {47, 12, "\\simulado\\AMOK.RAR", "koma" }, {47, 13, "\\simulado\\SCREAM2.RAR", "2maercs" }, {47, 14, "\\simulado\\SWIV3.RAR", "3viws" }, {47, 18, "\\aventura\\FABLE.RAR", "elbaf" }, {47, 19, "\\aventura\\HAVE.RAR", "evah" } }; void DibujaPantalla(void) { clrscr(); prueba1.locateText( 0, 0, "úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú", BLACK, LIGHTGRAY ); prueba1.locateText( 0, 1, " Arcade úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú Estrategia úúúúúúúúúúúúúúúú", BLACK, LIGHTGRAY ); prueba1.locateText( 0, 2, "úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú", BLACK, LIGHTGRAY ); prueba1.locateText( 0, 3, "úú Alien Trilogy úúúúúúúúúúúúúúúúúú Battle Cruiser 3000 AD ", BLACK, LIGHTGRAY ); prueba1.locateText( 0, 4, "úú Balm Machine Head úúúúúúúúúúúúúúúúúú Jagged Alliance ", BLACK, LIGHTGRAY ); prueba1.locateText( 0, 5, "úú Bubble Bobble Combo úúúúúúúúúúúúúúúúúú Third Reich ", BLACK, LIGHTGRAY ); prueba1.locateText( 0, 6, "úú Eradicator úúúúúúúúúúúúúúúúúú Age of Rifles ", BLACK, LIGHTGRAY ); prueba1.locateText( 0, 7, "úú Syndicate Wars 2 úúúúúúúúúúúúúúúúúú Harpoon 2 ", BLACK, LIGHTGRAY ); prueba1.locateText( 0, 8, "úú Tomb Raider úúúúúúúúúúúúúúúúúú Command Conquer Red Alert ", BLACK, LIGHTGRAY ); prueba1.locateText( 0, 9, "úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú", BLACK, LIGHTGRAY ); prueba1.locateText( 0,10, " Deportivos úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú Simuladores úúúúúúúúúúúúúúúú", BLACK, LIGHTGRAY ); prueba1.locateText( 0,11, "úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú", BLACK, LIGHTGRAY ); prueba1.locateText( 0,12, "úú Espn NBA AirBorne'96 úúúúúúúúúúúúúúúúúú Amok ", BLACK, LIGHTGRAY ); prueba1.locateText( 0,13, "úú Australian Rugby League úúúúúúúúúúúúúúúúúú Screamer 2 ", BLACK, LIGHTGRAY ); prueba1.locateText( 0,14, "úú Fifa Soccer 97 úúúúúúúúúúúúúúúúúú Swiv 3D ", BLACK, LIGHTGRAY ); prueba1.locateText( 0,15, "úú Pc Futbol v5.0 úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú", BLACK, LIGHTGRAY ); prueba1.locateText( 0,16, "úú Space Jam úúúúúúúúúúúúúúúú Aventuras úúúúúúúúúúúúúúúú", BLACK, LIGHTGRAY ); prueba1.locateText( 0,17, "úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú", BLACK, LIGHTGRAY ); prueba1.locateText( 0,18, "úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú Fable ", BLACK, LIGHTGRAY ); prueba1.locateText( 0,19, "úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú No tengo boca y quiero gr.", BLACK, LIGHTGRAY ); prueba1.locateText( 0,20, "úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú", BLACK, LIGHTGRAY ); prueba1.locateText( 0,21, "úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú", BLACK, LIGHTGRAY ); prueba1.locateText( 1,46, "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ", WHITE, LIGHTGRAY);textcolor(BLACK); prueba1.locateText(78,46, "¿", BLACK, LIGHTGRAY); prueba1.locateText( 1,47, "³", WHITE, LIGHTGRAY);prueba1.locateText( 2,47, " ³", BLACK, LIGHTGRAY); prueba1.locateText( 1,48, "À", WHITE, LIGHTGRAY);textcolor(BLACK); prueba1.locateText( 2,48, "ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ", BLACK, LIGHTGRAY); }; char far *screen;// = (char far *)0xB8000000; void Kit(void) { static char Dir = 1; static char Pos = 0; char longt; for ( longt = 0; longt < 10; longt++ ) { if ( (Dir*longt + Pos) >= 0 && (Dir*longt + Pos) <= 75 ) { screen[ 47*80*2 + ( Pos + Dir*longt + 2)*2 + 1 ] &= 0x8F; screen[ 47*80*2 + ( Pos + Dir*longt + 2)*2 + 1 ] |= 7<<4; /* gotoxy( Pos + Dir*longt + 3, 24 ); prueba1.locateText( 0, 0, " " ); */ } } Pos += Dir; if ( Pos < 0 -2 ) Dir = 1; if ( Pos > 75 +2 ) Dir = -1; for ( longt = 0; longt < 10; longt++ ) { if ( (Dir*longt + Pos) >= 0 && (Dir*longt + Pos) <= 75 ) { /* gotoxy( Pos + Dir*longt + 3, 24 ); prueba1.locateText( 0, 0, "þ" ); */ screen[ 47*80*2 + ( Pos + Dir*longt + 2)*2 + 1 ] &= 0x8F; screen[ 47*80*2 + ( Pos + Dir*longt + 2)*2 + 1 ] |= 3<<4; } } delay( /*1000*/25 ); } void main(void) { int ok = 0; int Item = 0, i; char buffer[80]; char *p; screen =(char *) prueba1.pPlano(); p = searchpath("rar.EXE"); printf("Search for rar.EXE : %s\n", p); if ( p == NULL ) { printf( "Debes copiar el archivo rar.ex al path como rar.exe\n"); printf( "Ejemplo: \n"); printf( " copy rar.ex C:\\dos\\RAR.EXE \n"); return; } textmode( C4350 ); RellenaTablas(); _setcursortype( _NOCURSOR ); prueba1.BorraTodo(); textoVirtual = prueba1.sPlano(); init_star(); DibujaPantalla(); for ( i = 0; i < 27; i++ ) { screen[ ArbolActual[Item].y*80*2 + (ArbolActual[Item].x+i)*2 + 1 ] &= 0x8F; screen[ ArbolActual[Item].y*80*2 + (ArbolActual[Item].x+i)*2 + 1 ] |= 5<<4; prueba1.locateText( 4, 47, " ", LIGHTGRAY, LIGHTGRAY ); sprintf( buffer, "Linea de comandos: rar x -p%s %s C:", /*strrev( */ArbolActual[Item].Passw/* )*/, ArbolActual[Item].Direc ); prueba1.locateText( 4,47, buffer, RED, LIGHTGRAY ); } while ( !ok ) { TunelEstrellas(); Actualiza(Cestrellas); prueba1.VuelcaPantallas(); Kit(); if ( kbhit() && (ok = getch()) == 0 ) { for ( i = 0; i < 27; i++ ) { screen[ ArbolActual[Item].y*80*2 + (ArbolActual[Item].x+i)*2 + 1 ] &= 0x8F; screen[ ArbolActual[Item].y*80*2 + (ArbolActual[Item].x+i)*2 + 1 ] |= 7<<4; } switch ( getch() ) { case 72: Item--; if ( Item < 0 ) Item = 21; break; case 80: Item++; if ( Item >= 22 ) Item = 0; break; } for ( i = 0; i < 27; i++ ) { screen[ ArbolActual[Item].y*80*2 + (ArbolActual[Item].x+i)*2 + 1 ] &= 0x8F; screen[ ArbolActual[Item].y*80*2 + (ArbolActual[Item].x+i)*2 + 1 ] |= 5<<4; prueba1.locateText( 4, 47, " ", LIGHTGRAY, LIGHTGRAY ); sprintf( buffer, "Linea de comandos: rar x -p%s %s C:", /*strrev( */ArbolActual[Item].Passw/* )*/, ArbolActual[Item].Direc ); prueba1.locateText( 4,47, buffer, RED, LIGHTGRAY ); } } if ( ok == 13 ) { sprintf( buffer, "-p%s", ArbolActual[Item].Passw ); execl ( p, p, "x", buffer, ArbolActual[Item].Direc, "C:", NULL); ok = 1; } if ( ok == 27 ) ok = 1; else ok = 0; } textbackground( BLACK ); textcolor( LIGHTGRAY ); textmode( C80 ); clrscr(); deinit_star(); } //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ void init_star(void) { randomize(); if ( ( Cestrellas = (CAMPO_de_ESTRELLAS *)malloc( sizeof(CAMPO_de_ESTRELLAS)*200 ) ) == NULL ) return; if ( ( o = (CAMPO_de_ESTRELLAS *)malloc( sizeof(CAMPO_de_ESTRELLAS)*200 ) ) == NULL ) return; llena_campo(Cestrellas); } void deinit_star(void) { free( Cestrellas ); free( o ); } void llena_campo(CAMPO_de_ESTRELLAS *Cest) { int estrellas; for ( estrellas = 0; estrellas < 200; estrellas++ ) pon_estrella( &Cest[estrellas] ); } void pon_estrella(CAMPO_de_ESTRELLAS *Cest) { Cest -> Ex = random(40)+1; Cest -> Ey = random(25)+1; Cest -> Ez = 100 ; Cest -> Ecolor = WHITE; } void Star3d(CAMPO_de_ESTRELLAS *Cest) { // Star3d( Cestrellas ); while( !kbhit() ) Actualiza(Cest); } void Actualiza(CAMPO_de_ESTRELLAS *Cest) { int Ex, Ey, conta; static float FactorMovimientoX = 0, FactorMovimientoY = 0, ox = 0, oy = 0; static float x=0.1, y=0.1; static char color = 0; for( conta=0; conta<200; conta++ ) { if ( o[conta].Ex+ox> 0 && o[conta].Ex+ox < 79 && o[conta].Ey+oy > 0 && o[conta].Ey+oy < 49 ) WriteChar50 ( o[conta].Ex+ox, o[conta].Ey+oy, '*', 0, 0, textoVirtual ); // putpixel ( o[conta].Ex+ox+5, o[conta].Ey+oy+(317/2), 0 ); Ex = ( ((200*Cest[conta].Ex)/Cest[conta].Ez));//+40; Ey = ( ((200*Cest[conta].Ey)/Cest[conta].Ez));//+25;//240; Cest[conta].Ez = Cest[conta].Ez - 5 ; o[conta].Ex = Ex; o[conta].Ey = Ey; color++; if ( color > 10 ) { if ( Cest[conta].Ecolor == WHITE ) Cest[conta].Ecolor = LIGHTGRAY; else if ( Cest[conta].Ecolor == LIGHTGRAY ) Cest[conta].Ecolor = DARKGRAY; else Cest[conta].Ecolor = WHITE; color = 0; } if ( Ex>79 && Ey>49 ) pon_estrella ( &Cest[conta] ); if ( Cest[conta].Ez <= 20 || Ex>79 || Ey>49 || Ex<0 || Ey<0 ) // if ( Cest[conta].Ez <= 20 || Ex>635 || Ey>470 || Ex<5 || Ey<317 ) pon_estrella ( &Cest[conta] ); if ( Ex+FactorMovimientoX > 0 && Ex+FactorMovimientoX < 79 && Ey+FactorMovimientoY > 0 && Ey+FactorMovimientoY < 49 ) // putpixel ( Ex+FactorMovimientoX, Ey+FactorMovimientoY+100, Cest[conta].Ecolor ); WriteChar50 ( Ex+FactorMovimientoX, Ey+FactorMovimientoY, '*', Cest[conta].Ecolor%16, 0, textoVirtual ); // putpixel ( Ex+FactorMovimientoX+5, Ey+FactorMovimientoY+(317/2), Cest[conta].Ecolor ); } ox = FactorMovimientoX; oy = FactorMovimientoY; FactorMovimientoX+= x; FactorMovimientoY+= y; if ( FactorMovimientoX > 1 ) x = -0.1; if ( FactorMovimientoX < -1 ) x = 0.1; if ( FactorMovimientoY > 1 ) y = -0.1; if ( FactorMovimientoY < -1 ) y = 0.1; }