signal!! :D
This commit is contained in:
parent
e62cfb662d
commit
c59f57e7af
|
@ -1,8 +1,10 @@
|
|||
30/10/2002
|
||||
----------
|
||||
|
||||
* Añadido la variable RESOLUTION, que a la hora de compilar el TUTOR2.PRG daba problemas.
|
||||
Ya se puede usar RESOLUTION =) (|RooT|)
|
||||
* Corregido en la graphics donde ponia "trasparente" por "traNsparente".
|
||||
(Er_Makina)
|
||||
* ¡Funciona Signal! =) Solo falta testearlo... (Er_Makina)
|
||||
|
||||
29/10/2002
|
||||
----------
|
||||
|
|
|
@ -189,8 +189,8 @@ BEGIN
|
|||
mueve_robots();
|
||||
end
|
||||
end
|
||||
//signal(prota,s_kill);
|
||||
//signal(type robot,s_kill);
|
||||
signal(prota,s_kill);
|
||||
signal(type robot,s_kill);
|
||||
muertos=0;
|
||||
cogido=0;
|
||||
ya=0;
|
||||
|
|
Binary file not shown.
|
@ -161,6 +161,7 @@ int ExportaFuncs(EXPORTAFUNCS_PARAMS)
|
|||
FUNCTION("exit",2,eDIV_Exit);
|
||||
FUNCTION("get_id",1,eDiv_GetId) ;
|
||||
FUNCTION("define_region",5,eDiv_DefineRegion) ;
|
||||
FUNCTION("signal",2,eDIV_Signal);
|
||||
|
||||
ENTRYPOINT( first_load ) ;
|
||||
ENTRYPOINT(frame);
|
||||
|
@ -242,9 +243,54 @@ int eDiv_DefineRegion(FUNCTION_PARAMS)
|
|||
return 1 ;
|
||||
}
|
||||
|
||||
void signal_tree(int proc, int signal, FUNCTION_PARAMS)
|
||||
{
|
||||
int id2;
|
||||
if(id2=local("son",proc)) {
|
||||
signal_tree(id2,signal,fp);
|
||||
reserved("status",proc)=signal;
|
||||
}
|
||||
while(local("bigbro",proc)) {
|
||||
proc=local("bigbro",proc);
|
||||
reserved("status",proc)=signal;
|
||||
}
|
||||
/*while(local("smallbro",proc)) {
|
||||
proc=local("smallbro",proc);
|
||||
reserved("status",proc)=signal;
|
||||
}*/
|
||||
}
|
||||
|
||||
int eDIV_Signal(FUNCTION_PARAMS)
|
||||
{
|
||||
int signal=getparm();
|
||||
int proc=getparm();
|
||||
char tree=FALSE;
|
||||
|
||||
if(signal>=100) {
|
||||
signal-=100;
|
||||
tree=TRUE;
|
||||
}
|
||||
|
||||
signal++;
|
||||
|
||||
/* Si se le pasa un ID */
|
||||
if(proc<fp->imem_max)
|
||||
{
|
||||
reserved("status",proc)=signal;
|
||||
if(tree && (proc=reserved("son",proc)))
|
||||
signal_tree(proc,signal,fp);
|
||||
}
|
||||
/* Si se le pasa un type */
|
||||
else {
|
||||
int i,p;
|
||||
for(i=0;i<*fp->num_procs;i++) {
|
||||
if(fp->procs_s[fp->proc_orden[i]].tipo==proc) {
|
||||
reserved("status",fp->procs_s[fp->proc_orden[i]].id)=signal;
|
||||
if(tree && (p=reserved("son",fp->procs_s[fp->proc_orden[i]].id)))
|
||||
signal_tree(fp->procs_s[fp->proc_orden[i]].id,signal,fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,3 +7,4 @@ struct _regions regions[32] ;
|
|||
int eDIV_Exit(FUNCTION_PARAMS);
|
||||
int eDiv_GetId(FUNCTION_PARAMS) ;
|
||||
int eDiv_DefineRegion(FUNCTION_PARAMS) ;
|
||||
int eDIV_Signal(FUNCTION_PARAMS);
|
||||
|
|
|
@ -23,8 +23,8 @@ int eDIV_UNLOAD_MAP(FUNCTION_PARAMS);
|
|||
*/
|
||||
int eDIV_LOAD_BMP(FUNCTION_PARAMS);
|
||||
int eDIV_COLLISION(FUNCTION_PARAMS);
|
||||
int eDIV_SET_TRASPARENT_COLOR(FUNCTION_PARAMS);
|
||||
int eDIV_GET_TRASPARENT_COLOR(FUNCTION_PARAMS);
|
||||
int eDIV_SET_TRANSPARENT_COLOR(FUNCTION_PARAMS);
|
||||
int eDIV_GET_TRANSPARENT_COLOR(FUNCTION_PARAMS);
|
||||
int eDIV_RGB(FUNCTION_PARAMS);
|
||||
int eDIV_ADVANCE(FUNCTION_PARAMS);
|
||||
int eDIV_XADVANCE(FUNCTION_PARAMS) ;
|
||||
|
|
|
@ -32,7 +32,7 @@ SDL_Surface *Mapa[0xFFF] ;
|
|||
SDL_Surface *fondo ;
|
||||
struct _file file0[0xFFF] ;
|
||||
int last_map[0xFF] ;
|
||||
int color_trasparente ;
|
||||
int color_transparente ;
|
||||
int define_region ;
|
||||
|
||||
typedef struct {
|
||||
|
@ -147,8 +147,8 @@ int ExportaFuncs(EXPORTAFUNCS_PARAMS)
|
|||
|
||||
FUNCTION("load_bmp",1,eDIV_LOAD_BMP) ;
|
||||
FUNCTION("collision",1,eDIV_COLLISION) ;
|
||||
FUNCTION("set_trasparent_color",1,eDIV_SET_TRASPARENT_COLOR) ;
|
||||
FUNCTION("get_trasparent_color",0,eDIV_GET_TRASPARENT_COLOR) ;
|
||||
FUNCTION("set_transparent_color",1,eDIV_SET_TRANSPARENT_COLOR) ;
|
||||
FUNCTION("get_transparent_color",0,eDIV_GET_TRANSPARENT_COLOR) ;
|
||||
FUNCTION("rgb",3,eDIV_RGB) ;
|
||||
FUNCTION("advance",1,eDIV_ADVANCE) ;
|
||||
FUNCTION("xadvance",2,eDIV_XADVANCE) ;
|
||||
|
@ -173,7 +173,7 @@ int ExportaFuncs(EXPORTAFUNCS_PARAMS)
|
|||
FUNCTION("graphic_info",3,eDIV_GRAPHIC_INFO) ;
|
||||
FUNCTION("fade",4,eDIV_FADE) ;
|
||||
FUNCTION("xput",6,eDIV_XPUT);
|
||||
FUNCTION("setmode",4,eDIV_SETMODE);
|
||||
// FUNCTION("setmode",4,eDIV_SETMODE);
|
||||
|
||||
ENTRYPOINT( frame ) ;
|
||||
ENTRYPOINT( first_load ) ;
|
||||
|
@ -211,6 +211,7 @@ int eDIV_COLLISION(FUNCTION_PARAMS)
|
|||
int id1, id2 ;
|
||||
int a, i ;
|
||||
SDL_Rect r1 , r2 ;
|
||||
int _status=reservedptr("status");
|
||||
a = getparm() ;
|
||||
|
||||
id1 = fp->procs_s[ fp->proc_orden[ *fp->proceso_actual ] ].id ;
|
||||
|
@ -224,7 +225,8 @@ int eDIV_COLLISION(FUNCTION_PARAMS)
|
|||
//if ( a < 4000000 )
|
||||
if(a<fp->imem_max)
|
||||
{
|
||||
if(a==id1) return 0;
|
||||
if(a==id1 || (fp->mem[id1+_status]!=2 && fp->mem[id1+_status]!=4))
|
||||
return 0;
|
||||
r1.x = local("x",id1) ;
|
||||
r1.y = local("y",id1) ;
|
||||
r1.w = files[f1].mapa[g1].Surface->w ;
|
||||
|
@ -259,7 +261,8 @@ int eDIV_COLLISION(FUNCTION_PARAMS)
|
|||
for ( i = *id_scan+1 ; i < *fp->num_procs ; i++ )
|
||||
{
|
||||
id2 = fp->procs_s[ fp->proc_orden[ i ] ].id;
|
||||
if(id2==id1) continue;
|
||||
if(id2==id1 || (fp->mem[id1+_status]!=2 && fp->mem[id1+_status]!=4))
|
||||
continue;
|
||||
|
||||
//Si el proceso se corresponde con el type
|
||||
if ( reserved("process_type",id2) == a )
|
||||
|
@ -317,7 +320,7 @@ int eDIV_LOAD_BMP(FUNCTION_PARAMS)
|
|||
files[0].mapa[i].existe = 1 ;
|
||||
files[0].mapa[i].cpoint[0].x = (int)files[0].mapa[i].Surface->w / 2 ;
|
||||
files[0].mapa[i].cpoint[0].y = (int)files[0].mapa[i].Surface->h / 2 ;
|
||||
SDL_SetColorKey( files[0].mapa[i].Surface , SDL_SRCCOLORKEY | SDL_RLEACCEL , color_trasparente ) ;
|
||||
SDL_SetColorKey( files[0].mapa[i].Surface , SDL_SRCCOLORKEY | SDL_RLEACCEL , color_transparente ) ;
|
||||
if ( i > last_map[0] )
|
||||
last_map[0] = i ;
|
||||
return i ;
|
||||
|
@ -336,16 +339,16 @@ int eDIV_LOAD_BMP(FUNCTION_PARAMS)
|
|||
/* */
|
||||
/*****************************************************************/
|
||||
|
||||
int eDIV_SET_TRASPARENT_COLOR(FUNCTION_PARAMS)
|
||||
int eDIV_SET_TRANSPARENT_COLOR(FUNCTION_PARAMS)
|
||||
{
|
||||
int b , i;
|
||||
int a = getparm() ;
|
||||
b = color_trasparente ;
|
||||
color_trasparente = a ;
|
||||
b = color_transparente ;
|
||||
color_transparente = a ;
|
||||
for ( i = 1 ; i <= last_map[0] ; i++ )
|
||||
{
|
||||
if ( files[0].mapa[i].existe )
|
||||
SDL_SetColorKey( files[0].mapa[i].Surface , SDL_SRCCOLORKEY | SDL_RLEACCEL , color_trasparente ) ;
|
||||
SDL_SetColorKey( files[0].mapa[i].Surface , SDL_SRCCOLORKEY | SDL_RLEACCEL , color_transparente ) ;
|
||||
}
|
||||
return b ;
|
||||
}
|
||||
|
@ -358,9 +361,9 @@ int eDIV_SET_TRASPARENT_COLOR(FUNCTION_PARAMS)
|
|||
/* */
|
||||
/*****************************************************************/
|
||||
|
||||
int eDIV_GET_TRASPARENT_COLOR(FUNCTION_PARAMS)
|
||||
int eDIV_GET_TRANSPARENT_COLOR(FUNCTION_PARAMS)
|
||||
{
|
||||
return color_trasparente ;
|
||||
return color_transparente ;
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
|
@ -807,7 +810,7 @@ int eDIV_NEW_MAP(FUNCTION_PARAMS)
|
|||
files[0].mapa[i].cpoint[0].x = cx ;
|
||||
files[0].mapa[i].cpoint[0].y = cy ;
|
||||
SDL_FillRect( files[0].mapa[i].Surface , NULL , c ) ;
|
||||
SDL_SetColorKey( files[0].mapa[i].Surface , SDL_SRCCOLORKEY | SDL_RLEACCEL , color_trasparente ) ;
|
||||
SDL_SetColorKey( files[0].mapa[i].Surface , SDL_SRCCOLORKEY | SDL_RLEACCEL , color_transparente ) ;
|
||||
if ( i > last_map[0] )
|
||||
last_map[0] = i ;
|
||||
return i ;
|
||||
|
@ -1258,7 +1261,12 @@ void frame(FUNCTION_PARAMS)
|
|||
|
||||
for ( i = 0 ; i < *fp->num_procs ; i++ )
|
||||
{
|
||||
int _status=reservedptr("status");
|
||||
id = fp->procs_s[ fp->proc_orden[i] ].id ;
|
||||
|
||||
if(fp->mem[id+_status]!=2 && fp->mem[id+_status]!=4)
|
||||
continue;
|
||||
|
||||
f = local("file",id);
|
||||
g = local("graph",id);
|
||||
r = local("region",id);
|
||||
|
@ -1378,7 +1386,7 @@ void first_load(FUNCTION_PARAMS2)
|
|||
|
||||
for ( i = 0 ; i < 0xFF ; i++ )
|
||||
last_map[i] = 0 ;
|
||||
color_trasparente = 0 ;
|
||||
color_transparente = 0 ;
|
||||
if (SDL_Init(SDL_INIT_VIDEO)) ;
|
||||
//k_error(K_ERR_SDL_INIT);
|
||||
|
||||
|
|
|
@ -141,14 +141,15 @@ int lista_quita( int num )
|
|||
int interprete()
|
||||
{
|
||||
|
||||
int i ;
|
||||
int _status=reservedptr("status");
|
||||
|
||||
// PROVISIONAL. Se tendra que cambiar para k soporte frame(int) y prioritys
|
||||
if ( num_proc_orden > 0 )
|
||||
{
|
||||
for ( proceso_actual = 0 ; proceso_actual < num_proc_orden ; proceso_actual++ )
|
||||
{
|
||||
proceso( proc_orden[ proceso_actual ], -1 ) ;
|
||||
if(procs_s[proc_orden[proceso_actual]].tipo==0 || mem[procs_s[proc_orden[proceso_actual]].id+_status]==2)
|
||||
proceso( proc_orden[ proceso_actual ], -1 ) ;
|
||||
}
|
||||
Call_Entrypoint(EDIV_frame);
|
||||
|
||||
|
@ -173,6 +174,7 @@ int proceso( int num, int padre )
|
|||
#ifdef DBG
|
||||
int actual_lin;
|
||||
#endif
|
||||
int _status=reservedptr("status");
|
||||
|
||||
num_proc = num ;
|
||||
imem = procs_s[num_proc].imem ;
|
||||
|
@ -353,6 +355,7 @@ int proceso( int num, int padre )
|
|||
}
|
||||
procs_s[num_proc].tipo = mem[ imem++ ] ;
|
||||
reserved("process_type",procs_s[num_proc].id) = procs_s[num_proc].tipo ;
|
||||
mem[procs_s[num_proc].id+_status] = 2;
|
||||
inicio_privadas=mem[6];
|
||||
break ;
|
||||
case lpri://33 POR HACER?
|
||||
|
@ -554,6 +557,11 @@ int proceso( int num, int padre )
|
|||
#endif /* DBG */
|
||||
}
|
||||
|
||||
if(mem[procs_s[num].id+_status]==1) {
|
||||
//mem[procs_s[num].id+_status=0;
|
||||
lista_quita(num_proc);
|
||||
}
|
||||
|
||||
if ( devolver > 0 && no_devuelve == 0 )
|
||||
{
|
||||
//pila[++sp] = 0 ;// AQUI SE DEBERA DEVOLVER EL ID
|
||||
|
|
|
@ -367,7 +367,8 @@ int main(int argc, char* argv[])
|
|||
*/
|
||||
|
||||
// PETA EN AMD???? <-- y esto? a mi no me peta.. (Er_Makina)
|
||||
tiempo_i ++ ;
|
||||
// me peta a veces por "division entre cero"
|
||||
/* tiempo_i ++ ;
|
||||
if ( tiempo_i > 99 ) tiempo_i = 0 ;
|
||||
tiempo[ tiempo_i ] = SDL_GetTicks() ;
|
||||
|
||||
|
@ -376,7 +377,7 @@ int main(int argc, char* argv[])
|
|||
else
|
||||
if ( tiempo[tiempo_i] - tiempo[tiempo_i+1] != 0 )
|
||||
global("fps") = 100000 / (tiempo[tiempo_i] - tiempo[tiempo_i+1] ) ;
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//SDL_BlitSurface( imagen1 , NULL , screen , NULL ) ;
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue