diff --git a/ediv/CHANGE_LOG.txt b/ediv/CHANGE_LOG.txt index 2c804e4..2349b74 100644 --- a/ediv/CHANGE_LOG.txt +++ b/ediv/CHANGE_LOG.txt @@ -4,6 +4,13 @@ para cambiárselo después de haber compilado un programa con ediv. mola eh? :) incluyo también un icono de pacman de ejemplo ke me kedó mu majo. (Er_Makina) + * Agregados all_drawing y all_text a sus correspondientes dll's. (Er_Makina) + * He incluido en la estructura fp funciones para errores (Runtime_Error y + Critical_Error). ¡¡Empezad a usarlas YA!! Tenéis una lista completa de los + errores en el language.c del stub. Podéis añadir nuevos errores aprovechando + los huecos, pero no añadáis a menos que estéis seguros de que ese error no + existe ya (si la descripción no es como os gusta, pos la cambiáis un poco, + hala). (Er_Makina) 6/9/2002 -------- diff --git a/ediv/src/dlls/dlls.suo b/ediv/src/dlls/dlls.suo index fdc3e77..f5ef7c7 100644 Binary files a/ediv/src/dlls/dlls.suo and b/ediv/src/dlls/dlls.suo differ diff --git a/ediv/src/dlls/export.h b/ediv/src/dlls/export.h index b7cc7e9..334bef7 100644 --- a/ediv/src/dlls/export.h +++ b/ediv/src/dlls/export.h @@ -65,6 +65,10 @@ typedef int (TYPEOF_Call_Entrypoint)(int ep, ...); // Dibuja typedef int (TYPEOF_Dibuja)(SDL_Surface *, SDL_Rect, SDL_Rect, int, int); +// Errores +typedef void (TYPEOF_Runtime_Error)(int, ...); +typedef void (TYPEOF_Critical_Error)(int, ...); + // estilo BO2K, sólo para "defaultear" las funciones como NULL /*extern TYPEOF_EDIV_Export *EDIV_Export; extern TYPEOF_EDIV_Export_Const *EDIV_Export_Const; @@ -227,6 +231,8 @@ struct _fun_params{ struct _files *files ; TYPEOF_Dibuja *Dibuja ; // <- Tienes una funcion identica a esta variable (Daijo) <<- Y que? , la funcion no esta dentro de esta estructura :P (Riseven) TYPEOF_Call_Entrypoint *Call_Entrypoint ; + TYPEOF_Runtime_Error *Runtime_Error ; + TYPEOF_Critical_Error *Critical_Error ; } ; diff --git a/ediv/src/dlls/graphics/main.c b/ediv/src/dlls/graphics/main.c index 9aa9e8d..305cc39 100644 --- a/ediv/src/dlls/graphics/main.c +++ b/ediv/src/dlls/graphics/main.c @@ -29,6 +29,8 @@ struct { #define TRANS 0x04 #define NOCOLORKEY 0x80 +#define MAX_DRAWS 1024 + //GRAPH *fondo; struct _files files[ 0xFF ] ; @@ -78,7 +80,7 @@ struct{ int x , y ; int t , c ; // requerido para move_draw() SDL_Surface *Surface ; -} draws[1024] ; +} draws[MAX_DRAWS] ; int last_draw ; @@ -136,6 +138,7 @@ int ExportaFuncs(EXPORTAFUNCS_PARAMS) CONST("g_x_center",2); CONST("g_y_center",3); + CONST("all_drawing",-1); GLOBAL_STRUCT("video_modes",31); @@ -1041,6 +1044,18 @@ int eDIV_DELETE_DRAW(FUNCTION_PARAMS2) { int n ; n = getparm() ; + + if(n==-1) { + for(n=0;nmem[ id + fp->varindex[_loc_flags] ] & 4 ) //SDL_SetAlpha(files[f].mapa[g].Surface, SDL_SRCALPHA , fp->mem[ id + fp->varindex[_loc_transparency] ] ) ; - if ( fp->mem[ id + fp->varindex[_loc_flags] ] & 8 ) + if ( fp->mem[ id + fp->varindex[_loc_flags] ] & 8 ) { trans = 255 - fp->mem[ id + fp->varindex[_loc_transparency] ] ; + if(trans<0) trans=0; else if(trans>255) trans=255; + } else trans = 128 ; else diff --git a/ediv/src/dlls/text/text.c b/ediv/src/dlls/text/text.c index edd9499..a30160a 100644 --- a/ediv/src/dlls/text/text.c +++ b/ediv/src/dlls/text/text.c @@ -7,8 +7,11 @@ #include "text.h" -struct _fuente_control_s fuente_control_s[0xFF]; -int existe[0xFF] ; +#define MAX_FONTS 0xFF +#define MAX_WRITES 0xFFF + +struct _fuente_control_s fuente_control_s[MAX_FONTS]; +int existe[MAX_FONTS] ; struct { @@ -20,11 +23,12 @@ struct int x , y ; int cx , cy ; SDL_Surface *imagen ; -}textos[0xFFF] ; +}textos[MAX_WRITES] ; int ExportaFuncs(EXPORTAFUNCS_PARAMS) { + CONST("all_text",0); FUNCTION("load_fnt",1,eDiv_LoadFnt) ; FUNCTION("write",5,eDiv_Write) ; @@ -47,13 +51,15 @@ int eDiv_LoadFnt(FUNCTION_PARAMS) fpos_t pos ; const char *filename=getstrparm(); // Fichero a cargar - for ( i = 1 ; i < 256 ; i++ ) + for ( i = 1 ; i <= MAX_FONTS ; i++ ) { if ( existe[i] == 0 ) break ; } - if ( i == 256 ) + if ( i == MAX_FONTS ) { + fp->Runtime_Error(113); // demasiadas fuentes return -1 ; + } fichero = fopen("text.txt" , "w+" ) ; fuente = fopen(filename, "rb" ) ; @@ -88,13 +94,20 @@ int eDiv_Write(FUNCTION_PARAMS) x = getparm() ; fuente = getparm() ; - for ( i = 1 ; i < 0xFFF ; i++ ) + if(fuente<0 || fuente>MAX_FONTS || !existe[fuente]) { + fp->Runtime_Error(116); // id de fuente no válido + return -1; + } + + for ( i = 1 ; i < MAX_WRITES ; i++ ) { if ( textos[i].existe == 0 ) break ; } - if ( i == 0xFFF ) + if ( i == MAX_WRITES ) { + fp->Runtime_Error(118); // demasiados textos return -1 ; + } textos[i].x = x ; @@ -163,14 +176,20 @@ int eDiv_WriteInt(FUNCTION_PARAMS) x = getparm() ; fuente = getparm() ; - for ( i = 1 ; i < 0xFFF ; i++ ) + if(fuente<0 || fuente>MAX_FONTS || !existe[fuente]) { + fp->Runtime_Error(116); // id de fuente no válido + return -1; + } + + for ( i = 1 ; i < MAX_WRITES ; i++ ) { if ( textos[i].existe == 0 ) break ; } - if ( i == 1024 ) + if ( i == MAX_WRITES ) { + fp->Runtime_Error(118); // demasiados textos return -1 ; - + } textos[i].x = x ; textos[i].y = y ; @@ -256,11 +275,22 @@ int eDiv_DeleteText(FUNCTION_PARAMS) int i ; i = getparm() ; - if ( !textos[i].existe ) + + if ( i<0 || i>MAX_WRITES || !textos[i].existe ) { + fp->Runtime_Error(119); // id de texto no válido return -1 ; + } + + if(i==0) { + for(i=1;i