all_drawing, all_text, Runtime_Error y Critical_Error
This commit is contained in:
parent
d9a892a450
commit
d81668235d
|
@ -4,6 +4,13 @@
|
||||||
para cambiárselo después de haber compilado un programa con ediv. mola
|
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.
|
eh? :) incluyo también un icono de pacman de ejemplo ke me kedó mu majo.
|
||||||
(Er_Makina)
|
(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
|
6/9/2002
|
||||||
--------
|
--------
|
||||||
|
|
Binary file not shown.
|
@ -65,6 +65,10 @@ typedef int (TYPEOF_Call_Entrypoint)(int ep, ...);
|
||||||
// Dibuja
|
// Dibuja
|
||||||
typedef int (TYPEOF_Dibuja)(SDL_Surface *, SDL_Rect, SDL_Rect, int, int);
|
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
|
// estilo BO2K, sólo para "defaultear" las funciones como NULL
|
||||||
/*extern TYPEOF_EDIV_Export *EDIV_Export;
|
/*extern TYPEOF_EDIV_Export *EDIV_Export;
|
||||||
extern TYPEOF_EDIV_Export_Const *EDIV_Export_Const;
|
extern TYPEOF_EDIV_Export_Const *EDIV_Export_Const;
|
||||||
|
@ -227,6 +231,8 @@ struct _fun_params{
|
||||||
struct _files *files ;
|
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_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_Call_Entrypoint *Call_Entrypoint ;
|
||||||
|
TYPEOF_Runtime_Error *Runtime_Error ;
|
||||||
|
TYPEOF_Critical_Error *Critical_Error ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ struct {
|
||||||
#define TRANS 0x04
|
#define TRANS 0x04
|
||||||
#define NOCOLORKEY 0x80
|
#define NOCOLORKEY 0x80
|
||||||
|
|
||||||
|
#define MAX_DRAWS 1024
|
||||||
|
|
||||||
//GRAPH *fondo;
|
//GRAPH *fondo;
|
||||||
|
|
||||||
struct _files files[ 0xFF ] ;
|
struct _files files[ 0xFF ] ;
|
||||||
|
@ -78,7 +80,7 @@ struct{
|
||||||
int x , y ;
|
int x , y ;
|
||||||
int t , c ; // requerido para move_draw()
|
int t , c ; // requerido para move_draw()
|
||||||
SDL_Surface *Surface ;
|
SDL_Surface *Surface ;
|
||||||
} draws[1024] ;
|
} draws[MAX_DRAWS] ;
|
||||||
|
|
||||||
int last_draw ;
|
int last_draw ;
|
||||||
|
|
||||||
|
@ -136,6 +138,7 @@ int ExportaFuncs(EXPORTAFUNCS_PARAMS)
|
||||||
CONST("g_x_center",2);
|
CONST("g_x_center",2);
|
||||||
CONST("g_y_center",3);
|
CONST("g_y_center",3);
|
||||||
|
|
||||||
|
CONST("all_drawing",-1);
|
||||||
|
|
||||||
|
|
||||||
GLOBAL_STRUCT("video_modes",31);
|
GLOBAL_STRUCT("video_modes",31);
|
||||||
|
@ -1041,6 +1044,18 @@ int eDIV_DELETE_DRAW(FUNCTION_PARAMS2)
|
||||||
{
|
{
|
||||||
int n ;
|
int n ;
|
||||||
n = getparm() ;
|
n = getparm() ;
|
||||||
|
|
||||||
|
if(n==-1) {
|
||||||
|
for(n=0;n<MAX_DRAWS;n++) {
|
||||||
|
if(draws[n].existe) {
|
||||||
|
SDL_FreeSurface( draws[n].Surface );
|
||||||
|
draws[n].existe = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
last_draw=0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !draws[n].existe )
|
if ( !draws[n].existe )
|
||||||
return -1 ;
|
return -1 ;
|
||||||
|
|
||||||
|
@ -1344,8 +1359,10 @@ void frame(FUNCTION_PARAMS2 )
|
||||||
dstrect.y -= files[f].mapa[g].cpoint[0].y ;
|
dstrect.y -= files[f].mapa[g].cpoint[0].y ;
|
||||||
if ( fp->mem[ id + fp->varindex[_loc_flags] ] & 4 )
|
if ( fp->mem[ id + fp->varindex[_loc_flags] ] & 4 )
|
||||||
//SDL_SetAlpha(files[f].mapa[g].Surface, SDL_SRCALPHA , fp->mem[ id + fp->varindex[_loc_transparency] ] ) ;
|
//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] ] ;
|
trans = 255 - fp->mem[ id + fp->varindex[_loc_transparency] ] ;
|
||||||
|
if(trans<0) trans=0; else if(trans>255) trans=255;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
trans = 128 ;
|
trans = 128 ;
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,8 +7,11 @@
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
|
||||||
|
|
||||||
struct _fuente_control_s fuente_control_s[0xFF];
|
#define MAX_FONTS 0xFF
|
||||||
int existe[0xFF] ;
|
#define MAX_WRITES 0xFFF
|
||||||
|
|
||||||
|
struct _fuente_control_s fuente_control_s[MAX_FONTS];
|
||||||
|
int existe[MAX_FONTS] ;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -20,11 +23,12 @@ struct
|
||||||
int x , y ;
|
int x , y ;
|
||||||
int cx , cy ;
|
int cx , cy ;
|
||||||
SDL_Surface *imagen ;
|
SDL_Surface *imagen ;
|
||||||
}textos[0xFFF] ;
|
}textos[MAX_WRITES] ;
|
||||||
|
|
||||||
|
|
||||||
int ExportaFuncs(EXPORTAFUNCS_PARAMS)
|
int ExportaFuncs(EXPORTAFUNCS_PARAMS)
|
||||||
{
|
{
|
||||||
|
CONST("all_text",0);
|
||||||
|
|
||||||
FUNCTION("load_fnt",1,eDiv_LoadFnt) ;
|
FUNCTION("load_fnt",1,eDiv_LoadFnt) ;
|
||||||
FUNCTION("write",5,eDiv_Write) ;
|
FUNCTION("write",5,eDiv_Write) ;
|
||||||
|
@ -47,13 +51,15 @@ int eDiv_LoadFnt(FUNCTION_PARAMS)
|
||||||
fpos_t pos ;
|
fpos_t pos ;
|
||||||
const char *filename=getstrparm(); // Fichero a cargar
|
const char *filename=getstrparm(); // Fichero a cargar
|
||||||
|
|
||||||
for ( i = 1 ; i < 256 ; i++ )
|
for ( i = 1 ; i <= MAX_FONTS ; i++ )
|
||||||
{
|
{
|
||||||
if ( existe[i] == 0 )
|
if ( existe[i] == 0 )
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
if ( i == 256 )
|
if ( i == MAX_FONTS ) {
|
||||||
|
fp->Runtime_Error(113); // demasiadas fuentes
|
||||||
return -1 ;
|
return -1 ;
|
||||||
|
}
|
||||||
|
|
||||||
fichero = fopen("text.txt" , "w+" ) ;
|
fichero = fopen("text.txt" , "w+" ) ;
|
||||||
fuente = fopen(filename, "rb" ) ;
|
fuente = fopen(filename, "rb" ) ;
|
||||||
|
@ -88,13 +94,20 @@ int eDiv_Write(FUNCTION_PARAMS)
|
||||||
x = getparm() ;
|
x = getparm() ;
|
||||||
fuente = 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 )
|
if ( textos[i].existe == 0 )
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
if ( i == 0xFFF )
|
if ( i == MAX_WRITES ) {
|
||||||
|
fp->Runtime_Error(118); // demasiados textos
|
||||||
return -1 ;
|
return -1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
textos[i].x = x ;
|
textos[i].x = x ;
|
||||||
|
@ -163,14 +176,20 @@ int eDiv_WriteInt(FUNCTION_PARAMS)
|
||||||
x = getparm() ;
|
x = getparm() ;
|
||||||
fuente = 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 )
|
if ( textos[i].existe == 0 )
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
if ( i == 1024 )
|
if ( i == MAX_WRITES ) {
|
||||||
|
fp->Runtime_Error(118); // demasiados textos
|
||||||
return -1 ;
|
return -1 ;
|
||||||
|
}
|
||||||
|
|
||||||
textos[i].x = x ;
|
textos[i].x = x ;
|
||||||
textos[i].y = y ;
|
textos[i].y = y ;
|
||||||
|
@ -256,11 +275,22 @@ int eDiv_DeleteText(FUNCTION_PARAMS)
|
||||||
int i ;
|
int i ;
|
||||||
i = getparm() ;
|
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 ;
|
return -1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i==0) {
|
||||||
|
for(i=1;i<MAX_WRITES;i++) {
|
||||||
|
textos[i].existe=0;
|
||||||
|
//SDL_FreeSurface(textos[i].imagen) ; // <--- por ke esta comentado??
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
textos[i].existe = 0 ;
|
textos[i].existe = 0 ;
|
||||||
//SDL_FreeSurface(textos[i].imagen) ;
|
//SDL_FreeSurface(textos[i].imagen) ; // <--- por ke esta comentado??
|
||||||
|
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,10 @@ typedef int (TYPEOF_Call_Entrypoint)(int ep, ...);
|
||||||
// Dibuja
|
// Dibuja
|
||||||
typedef int (TYPEOF_Dibuja)(SDL_Surface *, SDL_Rect , SDL_Rect , int , int ) ;
|
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, ...);
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// ENTRY-POINTS
|
// ENTRY-POINTS
|
||||||
///////////
|
///////////
|
||||||
|
@ -247,6 +251,8 @@ struct _fun_params{
|
||||||
struct _files *files ;
|
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_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_Call_Entrypoint *Call_Entrypoint ;
|
||||||
|
TYPEOF_Runtime_Error *Runtime_Error ;
|
||||||
|
TYPEOF_Critical_Error *Critical_Error ;
|
||||||
} fp ;
|
} fp ;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,14 +42,14 @@
|
||||||
*
|
*
|
||||||
* Genera un error en tiempo de ejecución, no crítico (en debug se llama al trazador)
|
* Genera un error en tiempo de ejecución, no crítico (en debug se llama al trazador)
|
||||||
* ATENCIÓN: Ahora mismo está en forma de RELEASE, para la versión DEBUG del stub se deberá
|
* ATENCIÓN: Ahora mismo está en forma de RELEASE, para la versión DEBUG del stub se deberá
|
||||||
* invocar al trazador (aún hay que decidir si el trazador estará metido en el propio stub o
|
* invocar al trazador (llamando a la función adecuada, que aún no está hecha, en debug.dll)
|
||||||
* si estará integrado en el entorno Delphi. En este último caso será necesaria una DLL
|
|
||||||
* especial para poder enlazar los datos de un programa y otro).
|
|
||||||
* Otra nota: he puesto exactamente los mismos errores de DIV2, ya que tenemos que mantener
|
* Otra nota: he puesto exactamente los mismos errores de DIV2, ya que tenemos que mantener
|
||||||
* la compatibilidad con el ignore_error... 100% compatible, recordad.. :P
|
* la compatibilidad con el ignore_error... 100% compatible, recordad.. :P
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void error(word num, ...)
|
// POR HACER: ignore_errors, ignore_error()
|
||||||
|
|
||||||
|
void error(int num, ...)
|
||||||
{
|
{
|
||||||
va_list opparam;
|
va_list opparam;
|
||||||
char mensaje[256];
|
char mensaje[256];
|
||||||
|
@ -75,7 +75,7 @@ void error(word num, ...)
|
||||||
* en que se produce un error de este tipo.
|
* en que se produce un error de este tipo.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void critical_error(word num, ...)
|
void critical_error(int num, ...)
|
||||||
{
|
{
|
||||||
va_list opparam;
|
va_list opparam;
|
||||||
char mensaje[256];
|
char mensaje[256];
|
||||||
|
|
|
@ -81,6 +81,8 @@ int ini_interprete()
|
||||||
fp.proceso_actual = &proceso_actual ;
|
fp.proceso_actual = &proceso_actual ;
|
||||||
fp.existe.regions = 0 ;
|
fp.existe.regions = 0 ;
|
||||||
fp.existe.dibuja = 0 ;
|
fp.existe.dibuja = 0 ;
|
||||||
|
fp.Runtime_Error=error;
|
||||||
|
fp.Critical_Error=critical_error;
|
||||||
|
|
||||||
|
|
||||||
return 1 ;
|
return 1 ;
|
||||||
|
|
|
@ -83,8 +83,8 @@ int* lin;
|
||||||
// PROTOTIPOS
|
// PROTOTIPOS
|
||||||
///
|
///
|
||||||
|
|
||||||
void error(word num, ...); // Mensaje de error no crítico (trazable)
|
void error(int num, ...); // Mensaje de error no crítico (trazable)
|
||||||
void critical_error(word num, ...); // Mensaje de error crítico
|
void critical_error(int num, ...); // Mensaje de error crítico
|
||||||
void stub_quit(); // Salir del stub
|
void stub_quit(); // Salir del stub
|
||||||
void* e_malloc(size_t size); // identico a malloc pero con errormsg utomático
|
void* e_malloc(size_t size); // identico a malloc pero con errormsg utomático
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue