commit 4eeaecd819119a0c19caf1b95ffe1651db4c9276 Author: jdg Date: Fri Sep 3 17:41:37 2021 +0200 First commit 14/08/1997 diff --git a/A.EXE b/A.EXE new file mode 100644 index 0000000..945d4c7 Binary files /dev/null and b/A.EXE differ diff --git a/AVENTURA.EXE b/AVENTURA.EXE new file mode 100644 index 0000000..076d164 Binary files /dev/null and b/AVENTURA.EXE differ diff --git a/AVENTURA.PRJ b/AVENTURA.PRJ new file mode 100644 index 0000000..27f3f31 Binary files /dev/null and b/AVENTURA.PRJ differ diff --git a/AVNTR_MM.CPP b/AVNTR_MM.CPP new file mode 100644 index 0000000..626117e --- /dev/null +++ b/AVNTR_MM.CPP @@ -0,0 +1,553 @@ + /**************************************************************************\ +|* *| +|* AVNTR_MM *| +|* *| +|* Descripci¢n: *| +|* M¢dulo principal de la aventura, y hasta el momento el *| +|* £nico. *| +|* *| +|* 1er Proyecto com£n entre Oscar y JD. ( 1§ de muchos ) *| +|* *| +|* Fecha: 12-06-97 00.58 / 01.34 *| +|* 10-07-97 13:05 / 14:07 *| +|* *| + \**************************************************************************/ + +#include + + +#include +#include +#include +#include + +#include "..\modex\modex.h" + + +#include +#include + +#define OK 0 +#define ERROR 1 + +#define CURSOR_NORMAL 1 + + +char raton; +void Error(int code); +void Inicializa_Raton(int x1, int y1, int x2, int y2); +#define MEMORIA 1 + + +class VirtualVGA +{ + private: + long size, Planos, uPlano; + + char huge *memVGA; + + public: + long cX, cY; + + VirtualVGA( long X, long Y ); + ~VirtualVGA() { delete[] memVGA; }; + void copiaImagen( long offset, char huge *src, long size ); + long Size( void ){ return size; }; + void VGA(void); + + char huge *memVirtual(void) { return memVGA; }; +}; + +VirtualVGA::VirtualVGA( long X, long Y ) +{ + + cY = Y; cX = X; + + size = sizeof( char ) * Y * X; + if ( ( memVGA = new char huge[size] ) == NULL ) + Error( MEMORIA ); + + // Calculamos el n§ de planos cortados que existen y el tama¤o del £ltimo + Planos = size / 0xFFFF; + uPlano = size % 0xFFFF; + +}; + +void VirtualVGA::copiaImagen( long offset, char huge *src, long size ) +{ + char huge *dst; + // offset indica el comienzo dentro del bloque destino + // src puntero + + dst = memVGA + offset; + while ( size-- ) *(dst++) = *(src++); + + // _fmemcpy( dst, scr, size ); +} + +void VirtualVGA::VGA(void) +{ + int i; + +// for ( i=0; i= 300 ) + draw_bitmap( (char far *)cuadroMandos.memVGA, 0, 300, cuadroMandos.cX, cuadroMandos.cY ); +*/ + int86(0x33, &io, &io); // lee posici¢n y estados del bot¢n + X_Mouse = io.x.cx; + Y_Mouse = io.x.dx; + + // Comprueba el tablero de control +// CompruebaMandos( X_Mouse, Y_Mouse, &cuadroMandos ); + // Comprueba el resto de posibilidades ( el juego en s¡ ) + + // ¨ Se Puls¢ Un BOTON ? + // B.Izquierdo B. Derecho + if ( (io.x.bx & 1) != 0 || ( (io.x.bx >> 1) & 1 ) != 0 ) + { +// copiaBitmap( CursorP[ pCanim ].memVirtual(), X_Mouse, Y_Mouse, CursorP[ pCanim ].cX, CursorP[ pCanim ].cY, VGAvirtual.memVirtual() ); + copiaBitmap( CursorP[ pCanim ].memVirtual(), X_Mouse, Y_Mouse, 32, 32, VGAvirtual.memVirtual() ); +// tdraw_bitmap( CursorP[ pCanim ].memVGA, X_Mouse, Y_Mouse, CursorP[ pCanim ].cX, CursorP[ pCanim ].cY ); + } else { +// copiaBitmap( CursorN[ pCanim ].memVirtual(), X_Mouse, Y_Mouse, CursorN[ pCanim ].cX, CursorN[ pCanim ].cY, VGAvirtual.memVirtual() ); + copiaBitmap( CursorN[ pCanim ].memVirtual(), X_Mouse, Y_Mouse, 32, 32, VGAvirtual.memVirtual() ); +// tdraw_bitmap( CursorN[ pCanim ].memVGA, X_Mouse, Y_Mouse, CursorN[ pCanim ].cX, CursorN[ pCanim ].cY ); + } + + // Copiamos la virtual a la real... + // Partido por la mierda de la segmentaci¢n de la memoria + VGAvirtual.VGA(); + } + + i++; + } while ( !kbhit() ); + + LiberaCursor( &CursorN, &CursorP ); +} + + + /**************************************************************************\ +|* *| +|* CargaPaleta *| +|* *| +|* Descripci¢n: *| +|* Carga la paleta con los colores por defecto *| +|* *| +|* *| +|* Entradas: achivo PCX de donde cargar la paleta *| +|* *| +|* Salidas: OK Todo ha ido bien *| +|* ERROR Algo va mal *| +|* *| + \**************************************************************************/ +int CargaPaleta(char *file ) +{ + int index; + FILE *fp; + + if ( (fp=fopen( file, "rb" ) ) == NULL ) + return ERROR; + + + if ( fseek( fp, -768L, SEEK_END ) == 0 ) + { + for (index=0; index<256; index++) + { + // get the red component + // get the green component + // get the blue component + // set components + set_dac_register ( index, (getc(fp) >> 2), (getc(fp) >> 2), (getc(fp) >> 2) ); + } // end for index + + } + + fclose( fp ); + return OK; +} + + + + /**************************************************************************\ +|* *| +|* MuestraImagen *| +|* *| +|* Descripci¢n: *| +|* Descomprime y copia a la pagina indicada un PCX *| +|* *| +|* Entradas: nombre de la imagen *| +|* pagina *| +|* color_invisible ( -1 si ninguno ) *| +|* *| +|* *| +|* Salidas: OK Todo ha ido bien *| +|* ERROR Algo va mal *| +|* *| + \**************************************************************************/ +int MuestraImagen( char *file, int page, int col_Inv ) +{ + int curr_page; + FILE *fp; + int alto, ancho, contador; + unsigned char byte; + + + if ( (fp = fopen( file,"rb")) != NULL ) + { + + curr_page = get_active_page(); + set_active_page(page); + + // Saltamos la cabecera + fseek( fp, 128, SEEK_SET ); + + for(alto=0; alto<240; alto++) + { + for(ancho=0; ancho<360; ) + { + byte=getc(fp); + if(byte<=0xC0) + { + if ( col_Inv < 0 || byte != col_Inv ) set_point (ancho, alto, byte); + ancho++; + } + else + { + contador=byte&0x3F; byte=getc(fp); + for(; contador>0; contador--) + { + if ( col_Inv < 0 || byte != col_Inv ) set_point (ancho, alto, byte); + ancho++; + } + } + } + } + fclose(fp); + } else return ERROR; + + set_active_page(curr_page); + + return OK; +} + +char far *CargaImagen( char *file, char huge *VGA, int cX, int cY ) +{ + int curr_page; + FILE *fp; + long alto, ancho, contador; + unsigned char byte; + + if ( (fp = fopen( file,"rb")) != NULL ) + { + + // Saltamos la cabecera + fseek( fp, 128, SEEK_SET ); + + for(alto=0; alto0; contador--) + { + *VGA = byte; VGA ++; +// set_point( ancho, alto, *(emptyVGA.memVGA + alto*emptyVGA.cX + ancho) ); + ancho++; + } + } + } + } + fclose(fp); + } else return NULL; + + return VGA; +} + + + + + /**************************************************************************\ +|* *| +|* Error *| +|* *| +|* Descripci¢n: *| +|* Aborta anormalmente el programa, mostrando un mensaje de *| +|* de error. *| +|* *| +|* Entradas: Codigo del mensaje de error a mostrar *| +|* Salidas: (ninguna) *| +|* *| + \**************************************************************************/ +void Error(int code) +{ + set_video_mode (3); + switch( code ) + { + case MEMORIA: + printf( "Ni un byte libre para mi!\n"); + break; + + } + exit(code); +}; + + + + + +// los par metros son las cotas para el raton +void Inicializa_Raton(int x1, int y1, int x2, int y2) +{ + +// Por defecto el raton aparecer  en las coordenadas ( 50, 50 ) +int px = 50, py = 50; + +// Pero si Y_ y X_ tienen unas coordenadas el raton se posiciona alli. +/* +if ( Y_Mouse != -1 && X_Mouse != -1 ) + { + px = X_Mouse; py = Y_Mouse; + } +*/ + union REGS ent, sal; + long dir; + + ent.x.ax = 0; + int86(0x33, &ent, &sal); /* averigua si hay rat¢n conectado */ + + raton = sal.x.ax; /* indica a la variable global el estado + del raton */ + + if(raton!=0) { + + ent.x.ax = 15; + ent.x.cx = 5; + ent.x.dx = 11; + int86(0x33, &ent, &sal); /* fija la raz¢n mickey/pixel */ + + ent.x.ax = 7; + ent.x.cx = x1; + ent.x.dx = x2; + int86(0x33, &ent, &sal); /* fija la posici¢n m x. y m¡n. horizontal */ + + ent.x.ax = 8; + ent.x.cx = y1; + ent.x.dx = y2; + int86(0x33, &ent, &sal); /* fija la posici¢n m x. y m¡n. vertical */ + + ent.x.ax = 4; + ent.x.cx = px; + ent.x.dx = py; + int86(0x33, &ent, &sal); /* fija la posici¢n del rat¢n */ + + ent.x.ax = 2; // Como sabes hacer esto, no sirve para nada + int86(0x33, &ent, &ent); // por que el raton no se puede mostrar y por + // deducion, tan poco ocultar. + // Pero " Por si el modo no es SVGA ", lo ocultamos + + } +} + +void LiberaCursor( VirtualVGA **CursorN, VirtualVGA **CursorP ) +{ +/* + int i; + + if ( (*CursorP) != NULL ) + { + for ( i=0; i<10; i++ ) + EliminaVirtual( &((*CursorP)[i]) ); + + free( (*CursorP) ); + } + + if ( (*CursorN) != NULL ) + { + for ( i=0; i<10; i++ ) + EliminaVirtual( &((*CursorN)[i]) ); + + free( (*CursorN) ); + } +*/ +} + +void CargaCursor( VirtualVGA **CursorN, VirtualVGA **CursorP, char TipoCursor ) +{ +/* + int i; + + // El cursor presionado solo se carga una vez ( siempre es el mismo ) + if ( (*CursorP) == NULL ) + { + // cargamos el cursor animado ( presionado ) :: 10 animaciones :: + if ( ( (*CursorP) = (VirtualVGA *)malloc( sizeof(VirtualVGA)*10 ) ) == NULL ) + Error( 0x00 ); + + for ( i=0; i<10; i++ ) + { + // CURSOR PRESIONADO: 32x32 + (*CursorP)[i].cX = 32; (*CursorP)[i].cY = 32; + CreaVirtual( &((*CursorP)[i]) ); + } + } + + if ( (*CursorN) == NULL ) + { + // cargamos el cursor animado ( liberado ) :: 10 animaciones :: + if ( ( (*CursorN) = (VirtualVGA *)malloc( sizeof(VirtualVGA)*10 ) ) == NULL ) + Error( 0x00 ); + + for ( i=0; i<10; i++ ) + { + // CURSOR PRESIONADO: 32x32 + (*CursorN)[i].cX = 32; (*CursorN)[i].cY = 32; + CreaVirtual( &((*CursorN)[i]) ); + } + } + + switch( TipoCursor ) + { + case CURSOR_NORMAL: + default: + for ( i=0; i<10; i++ ) + { + // CURSOR PRESIONADO: 32x32 + } + break; + } +*/ +} + + +void copiaBitmap( char huge *src, int cX, int cY, int wX, int wY, char huge *tgt ) +{ + long i; char c; + long offY; + + wY = (cY + wY); wY = wY >= 400 ? 400 : wY; + wX = (cX + wX); wX = wX >= 360 ? 360 : wX; + + for ( ; cY < wY; cY++ ) + { + offY = (long)cY*360; + for ( i = cX; i < wX; i++ ) + if ( ( c = *(src++) ) != 0 ) + *(tgt + offY + i ) = c; + } +} diff --git a/BOCETO.PCX b/BOCETO.PCX new file mode 100644 index 0000000..d6a1be6 Binary files /dev/null and b/BOCETO.PCX differ diff --git a/CONTROL.PCX b/CONTROL.PCX new file mode 100644 index 0000000..0f4392b Binary files /dev/null and b/CONTROL.PCX differ