From d81668235dd4b524d90abf1b0e6cfdf49796c75739f2c95d78afd62a479a36da Mon Sep 17 00:00:00 2001 From: Gabriel Lorenzo Date: Mon, 9 Sep 2002 15:45:23 +0000 Subject: [PATCH] all_drawing, all_text, Runtime_Error y Critical_Error --- ediv/CHANGE_LOG.txt | 7 +++++ ediv/src/dlls/dlls.suo | Bin 19968 -> 20480 bytes ediv/src/dlls/export.h | 6 ++++ ediv/src/dlls/graphics/main.c | 21 +++++++++++-- ediv/src/dlls/text/text.c | 54 ++++++++++++++++++++++++++-------- ediv/src/shared/extern.h | 6 ++++ ediv/src/stub/error.c | 10 +++---- ediv/src/stub/inte.c | 2 ++ ediv/src/stub/main.h | 4 +-- ediv/src/visual c/ediv_ws.suo | Bin 18944 -> 17920 bytes 10 files changed, 89 insertions(+), 21 deletions(-) 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 fdc3e77ee23fe45286a62fc38690fa0b0998cf2fa502ca27d25ed36969aae4d8..f5ef7c7e80ca675eb532c9a8c39c64d8481cc7c9a268295db07deaccb0cf66d5 100644 GIT binary patch delta 981 zcmaKqO=uHQ5Xa|jc9S&Om!|pHL|fEozRbmh6d@E_VfA3rns^g$qVttr+wu z9-0yAp$DPh$%Ax{-b@dIAk9@l{5*K62syMKs`KI|ttGfH?3>^G_y6Y2zWOq&KV>f- zODt|KN@doNCz%sl@*)2Hz%A|kD`o?LdJgC1Gn@_5TI9d!!69c7H{}9nLl)`KmK?>C zP8sKv0tb0drNL!$Q(1D1+HFsmOZXg-fK?s{&(8BK3=6L*XIAcFci=eWAg6#Gn>;e$ zAEni+_X!zGvm5BWxX`rMEnR_>E6ATmZ?}kROq=qce?agclmsp}V zm*{`zVy=cF{9ZwvZyGMcb+`>RFlYtvQnYXts&Elz;Tn}LQHlPV&BQy3Gh&iPPokwoTdO+5sE8>Dg*$sLQx~jD%=FELew%bs60nD0EiJeY}R8<7iZ#Z z!^FC0L?gY9Ywq-lk&z-Fsjy9zZ}k2|@tNWa#a9Z!w-?WqS4VZS2@ugJc5KE=szg9^ z(}V5t60Rv}G$x9uD;cvr@!oc@H_uq#d72ygBfGmJ%F>k^WB8V9xSStxWXbw8ohFkQ z#&`LY7VrQ4{z8!LY?A0NIy>oR$q@8 zyopeEgkE|mC|=T<;`clZ)V2^i($;lDSNB_^K;|ICou%H&fuE7qF{`UlJ*~3IBv|~zN}!&EZ{{$;;LT3 zQnBDF>Fw(q(b=2YwlG;ct%0b&4C-*L_i1?kg<`=0EmJ&$(=Z2fI_TI^+2Lb4K!@7s zxToT-eaYf>QBnqN_vCcMrXUr;HM?v@=xBs;`X~kK*s)Yv_*-}@0p=OPckel?x=o7TMpbwp5Rfz=AbV%y?#qUE?eaDUubj%ahTw^o!L5U?HEuZ{-sc`N7wZR+8ed$IM{SwfPZ&aU<_41K(Yp I#4&a2FQ7{EGynhq 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;ig!!#u(Rx&J$(R#b1gbVs1LNS2k{l=;At0 zIHyH|e>)FxtklP2t}dGzqqb8;ok-?f-%Ji^g?xraXoxPrI_kzUsWw*)wp5Wm#Lm)1 zSUXD4^iqKO(Vtea^E8Gzy|89w?Uvhy&45`7{_RlRXcmuoPvH2bN6;Stm4XHI55W_j z50rm{;`a%`?57h?i7;xo11L?EC(^%|V zH7JJ1o`UNS1VeT8Y()Hgf1{gy4zoNNvkU$j5Axk;1xMT8@tv(zyl}wFKVku)$(fx) Pnkj^zbT8V;OYztr_?X;D delta 1223 zcmaizTS(JU9LIm>zqvV?o0`t0&9n;`Y1x|T)VYf#VH(ke0u3t5ibhGZ)LOccL>C{b zUqKLpP*~B;{CBsk%ZVU8l1*>5`t*`7=qs$rs(Fv+yO}W>oc}UVkNgGw`+YmMM-?aWtWRn zTx#)!TTSg^gnycr>8D~P4vZh%l)gfrJf?^$<!N^W2v%N+gGCiwpw`MmMF#|5$yhA>Tx-c;XL&|iG@W(hiJeFFT;*uU z&ic>Me4?=CuOsc4BQA3^nWo3w%59}xT;)j+5&zjSjmAU!!6(c$Y$>lyY@m&(>qhcY z4PU9m*`JC!m z&Pkp|A<4nnJ0#AtrJ~a`e8{uZx`(zRnw^LRbwi#T5$D8wS5OJnk(-b=)MPvT0kKpv A%>V!Z