diff --git a/ediv/bin/ROBOTS.PRG b/ediv/bin/ROBOTS.PRG index 0bae69b..219675b 100644 --- a/ediv/bin/ROBOTS.PRG +++ b/ediv/bin/ROBOTS.PRG @@ -47,6 +47,7 @@ PRIVATE espe; BEGIN + set_mode(320,200,8,_fullscreen); load_fpg("robots.fpg"); load_fnt("system.fnt"); write(1,0,0,0,"Pulsa F1 para obtener ayuda"); diff --git a/ediv/bin/bum.prg b/ediv/bin/bum.prg index 56c7ca3..cac7d4c 100644 --- a/ediv/bin/bum.prg +++ b/ediv/bin/bum.prg @@ -3,6 +3,7 @@ private numprocs; begin + set_mode(320,200,32,_fullscreen); rand_seed(343); // load_bmp("hola.bmp"); load_fpg("test.fpg"); diff --git a/ediv/bin/test/torus3.prg b/ediv/bin/test/torus3.prg new file mode 100644 index 0000000..8e149c3 --- /dev/null +++ b/ediv/bin/test/torus3.prg @@ -0,0 +1,209 @@ +/* + * TOROIDE EN 3D + * Adaptado de un ejemplo de PCMan¡a + * s¡, antes en PCMan¡a hab¡a cosas de programaci¢n... :'( + * + * TECLAS: + * Space = detener/continuar rotaci¢n + * P = alternar entre modo puntos/wireframe + */ + +Program Torus; +GLOBAL + Total_puntos; + Total_lineas; + donut[500,2]; + Rotado[500,2]; + lineas[1000,1]; + xdeg,ydeg,zdeg; + xoff,yoff,zoff; + sen[360],cosen[360]; + dibupun; + gir=1; + +BEGIN + set_mode(800,600,8,_fullscreen); + crea_tablas(); + repeat + clear_screen(); + gira_Donut(xdeg,ydeg,zdeg); + pon_lineas(rgb(255,255,0)); + frame; + if(key(_p)) + dibupun++; + while(key(_p)) + frame; + end + end + if(key(_space)) + gir++; + while(key(_space)) + frame; + end + end + if(gir) + xdeg=(xdeg+3)mod 360; + ydeg=(ydeg+3)mod 360; + zdeg=(zdeg+3)mod 360; + end + until(key(_enter)) +END + + +Function Line(x1,y1,x2,y2,color) +PRIVATE + i,deltax,deltay,numpixels; + d,dinc1,dinc2; + xx,xinc1,xinc2; + yy,yinc1,yinc2; + +BEGIN + deltax=abs(x2-x1); + deltay=abs(y2-y1); + if(deltax=>deltay) + numpixels=deltax+1; + d=(2*deltay)-deltax; + dinc1=deltay; + dinc2=(deltay-deltax); + xinc1=1; + xinc2=1; + yinc1=0; + yinc2=1; + else + numpixels=deltay+1; + d=(2*deltax)-deltay; + dinc1=deltax; + dinc2=(deltax-deltay); + xinc1=0; + xinc2=1; + yinc1=1; + yinc2=1; + end + if(x1>x2) + xinc1=-xinc1; + xinc2=-xinc2; + end + if(y1>y2) + yinc1=-yinc1; + yinc2=-yinc2; + end + for(i=1;i<=numpixels;i++) + put_pixel(x1,y1,color); + if(d<0) + d+=dinc1; + x1+=xinc1; + y1+=yinc1; + else + d+=dinc2; + x1+=xinc2; + y1+=yinc2; + end + end +END + + +Function Crea_donut(radio1,radio2,partes1,partes2) +PRIVATE + cont1,cont2; + circulo[25,2]; + xtemp; + +BEGIN + if(partes1*partes2>500) + // demasiao p'al body :P + return; + end + total_lineas=0; + total_puntos=partes1*partes2; + for(cont1=1;cont1<=partes1;cont1++) + circulo[cont1,0]=radio1*sen[360*cont1/partes1]+radio2*256; + circulo[cont1,1]=radio1*cosen[360*cont1/partes1]; + end + for(cont2=1;cont2<=partes2;cont2++) + for(cont1=1;cont1<=partes1;cont1++) + xtemp=circulo[cont1,0]; + donut[(cont2-1)*partes1+cont1,0]=xtemp*cosen[360*cont2/partes2]/256; + donut[(cont2-1)*partes1+cont1,1]=circulo[cont1,1]; + donut[(cont2-1)*partes1+cont1,2]=xtemp*sen[360*cont2/partes2]/256; + total_lineas++; + lineas[total_lineas,0]=(cont2-1)*partes1+cont1; + lineas[total_lineas,1]=(cont2-1)*partes1+(cont1 mod partes1)+1; + total_lineas++; + lineas[total_lineas,0]=(cont2-1)*partes1+cont1; + lineas[total_lineas,1]=(((cont2-1)*partes1+(cont1)+partes1-1)mod (total_puntos))+1; + end + end +END + +Function Crea_tablas(); +PRIVATE + xpos,ypos; + cont; + +BEGIN + xoff=400; + yoff=300; + zoff=32; + total_puntos=0; + from cont=0 to 360; + sen[cont]=(256*sin(pi*2*cont/360))/1000; + cosen[cont]=(256*cos(pi*2*cont/360))/1000; + end + crea_donut(5,15,15,15); +END + +Function Gira_Donut(Xrot,Yrot,Zrot); +PRIVATE + cont; + xtemp; + ytemp; + ztemp; + +BEGIN + for(cont=1;cont<=total_puntos;cont++) + rotado[cont,0]=Donut[cont,0]; + rotado[cont,1]=Donut[cont,1]; + rotado[cont,2]=Donut[cont,2]; + if(xrot<>0) + ytemp=rotado[cont,1]; + ztemp=rotado[cont,2]; + rotado[cont,1]=(ytemp*cosen[xrot]-ztemp*sen[xrot])/256; + rotado[cont,2]=(ytemp*sen[xrot]+ztemp*cosen[xrot])/256; + end + if(yrot<>0) + xtemp=rotado[cont,0]; + ztemp=rotado[cont,2]; + rotado[cont,0]=(ztemp*sen[yrot]+xtemp*cosen[yrot])/256; + rotado[cont,2]=(ztemp*cosen[xrot]-xtemp*sen[yrot])/256; + end + if(zrot<>0) + xtemp=rotado[cont,0]; + ytemp=rotado[cont,1]; + rotado[cont,0]=(xtemp*cosen[zrot]-ytemp*sen[zrot])/256; + rotado[cont,1]=(xtemp*sen[zrot]+ytemp*cosen[zrot])/256; + end + end +END + +Function Pon_lineas(col) +PRIVATE + cont; + punto1,punto2; + xfin1,yfin1; + xfin2,yfin2; + +BEGIN + for(cont=1;cont<=total_lineas;cont++) + punto1=lineas[cont,0]; + punto2=lineas[cont,1]; + xfin1=xoff+rotado[punto1,0]/(zoff+rotado[punto1,2]/256); + yfin1=yoff+rotado[punto1,1]/(zoff+rotado[punto1,2]/256); + xfin2=xoff+rotado[punto2,0]/(zoff+rotado[punto2,2]/256); + yfin2=yoff+rotado[punto2,1]/(zoff+rotado[punto2,2]/256); + if(!dibupun) + line(xfin1,yfin1,xfin2,yfin2,col); + else + put_pixel(xfin1,yfin1,col); + end + end +END diff --git a/ediv/src/shared/extern.h b/ediv/src/shared/extern.h index 8ea5a76..7e79f42 100644 --- a/ediv/src/shared/extern.h +++ b/ediv/src/shared/extern.h @@ -75,8 +75,13 @@ typedef int (TYPEOF_EDIV_Export_Priority)(int priority); /* Call_Entrypoint */ typedef int (TYPEOF_Call_Entrypoint)(int ep, ...); +typedef struct { + short x, y; + unsigned short w, h; +} eDIV_Rect; + /* Dibuja */ -typedef int (TYPEOF_Dibuja)(SDL_Surface *, SDL_Rect , SDL_Rect , int , int ) ; +typedef int (TYPEOF_Dibuja)(byte *, eDIV_Rect , eDIV_Rect , int , int ) ; /* Errores */ typedef void (TYPEOF_Runtime_Error)(int, ...); @@ -205,8 +210,10 @@ struct _existe { struct _file { - SDL_Surface *Surface ; - int existe ; + byte *Surface; + int w,h; + int bpp; + int existe; struct { int x , y ; @@ -218,8 +225,17 @@ struct _files int num ; int existe ; struct _file *mapa ; -} ; +}; +typedef struct { + int ancho; + int alto; + int bpp; + int flags; + int resflags; + byte* buffer; + byte* background; +} _graphics; struct _fun_params{ int *pila ; @@ -245,7 +261,7 @@ struct _fun_params{ int imem_max; int* nullstring; int* nstring; - SDL_Surface *screen; + _graphics* graphics; } fp ; diff --git a/ediv/src/stub/error.c b/ediv/src/stub/error.c index c4dde9f..8f10fe6 100644 --- a/ediv/src/stub/error.c +++ b/ediv/src/stub/error.c @@ -35,6 +35,8 @@ #ifdef _WIN32 # include #endif +#include + #include "main.h" #include "language.h" @@ -85,7 +87,7 @@ void critical_error(int num, ...) { va_list opparam; char mensaje[256]; - + va_start(opparam,num); sprintf(mensaje,translate(0), num); vsprintf(mensaje,translate_critical_error(num),opparam); diff --git a/ediv/src/stub/fatal.c b/ediv/src/stub/fatal.c index c3fd60b..bd2daaf 100644 --- a/ediv/src/stub/fatal.c +++ b/ediv/src/stub/fatal.c @@ -43,7 +43,7 @@ void eDIV_UninstallParachute(void) #include #include -#include +//#include #include "fatal.h" #include "main.h" @@ -123,7 +123,7 @@ static void eDIV_Parachute(int sig) fprintf(stderr,"\n"); } #endif - SDL_Quit(); + //SDL_Quit(); exit(-sig); } diff --git a/ediv/src/stub/inte.c b/ediv/src/stub/inte.c index 42d84b1..6317cba 100644 --- a/ediv/src/stub/inte.c +++ b/ediv/src/stub/inte.c @@ -28,7 +28,7 @@ #include #include -#include +//#include #include "extern.h" #include "edivfont.h" @@ -40,6 +40,7 @@ int first_loaded ; +_graphics graphics; int ini_interprete() { @@ -90,6 +91,9 @@ int ini_interprete() fp.imem_max=imem_max; fp.nullstring=nullstring; fp.nstring=&nstring; + fp.graphics=&graphics; + + memset(&graphics,0,sizeof(graphics)); #ifdef DBG last_lin=0; diff --git a/ediv/src/stub/main.h b/ediv/src/stub/main.h index fc858aa..dabb307 100644 --- a/ediv/src/stub/main.h +++ b/ediv/src/stub/main.h @@ -21,7 +21,7 @@ #ifndef __MAIN_H #define __MAIN_H -#include +//#include #include "shared.h" //#define DEBUG_DLL // para mostrar información al cargar las DLLs @@ -70,13 +70,12 @@ int proceso_actual ; // indice para proc_orden // // SDL (esto debe desaparecer en breve :p) // -SDL_Surface * screen; +/*SDL_Surface * screen; SDL_Surface * screen1; //SDL_Surface * imgs[255]; SDL_Event event[0xFF]; -Uint8 * keys; - +Uint8 * keys;*/ // // DEBUG diff --git a/ediv/src/stub/stub.c b/ediv/src/stub/stub.c index bb39d99..4a0eb04 100644 --- a/ediv/src/stub/stub.c +++ b/ediv/src/stub/stub.c @@ -47,19 +47,23 @@ * mem, imem_max, etc) */ +/*#ifdef main +#undef main +#endif*/ + int main(int argc, char* argv[]) { //FILE *f; int f , i; int stub_size; int mimem[10]; - Uint32 tiempo[100] , tiempo_i ; + unsigned int tiempo[100] , tiempo_i ; FILE *file_tiempo ; byte * ptr; unsigned long len,len_descomp; byte* vartemp; byte* p; - Uint8* teclas; + //Uint8* teclas; char capturef[50]; //const SDL_version* sdl_version; @@ -280,8 +284,8 @@ int main(int argc, char* argv[]) // AHORA TODO ESTO EN LA GRAPHICS.DLL // SE INICIALIZA LA SDL - if (SDL_Init(SDL_INIT_TIMER)) - critical_error(7); // no puedo inicializar SDL + //if (SDL_Init(SDL_INIT_TIMER)) + // critical_error(7); // no puedo inicializar SDL //atexit(stub_quit); @@ -322,7 +326,7 @@ int main(int argc, char* argv[]) */ //assert(0); - noevent=0; + /*noevent=0; while ( SDL_PollEvent(&event[0] ) && !noevent ) { switch( event[0].type ) @@ -345,7 +349,7 @@ int main(int argc, char* argv[]) strcpy(capturef,fp.nombre_program); strcat(capturef,".bmp"); SDL_SaveBMP(fp.screen,capturef); - } + }*/ interprete(); @@ -413,7 +417,7 @@ void stub_quit(int n) free(varindex[i].nombre); } free(varindex); - SDL_Quit(); + //SDL_Quit(); //atexit(SDL_Quit); exit(n); } diff --git a/ediv/src/stub/varindex.c b/ediv/src/stub/varindex.c index b3d539a..a071bd0 100644 --- a/ediv/src/stub/varindex.c +++ b/ediv/src/stub/varindex.c @@ -20,6 +20,9 @@ #include #include +#ifdef _DEBUG +# include +#endif #include "main.h" #include "varindex.h" diff --git a/ediv/src/visual c/ediv_ws.suo b/ediv/src/visual c/ediv_ws.suo index 889b8b4..4080266 100644 Binary files a/ediv/src/visual c/ediv_ws.suo and b/ediv/src/visual c/ediv_ws.suo differ diff --git a/ediv/src/visual c/stub/stub.vcproj b/ediv/src/visual c/stub/stub.vcproj index e8f306b..d231402 100644 --- a/ediv/src/visual c/stub/stub.vcproj +++ b/ediv/src/visual c/stub/stub.vcproj @@ -25,6 +25,7 @@ Optimization="0" AdditionalIncludeDirectories="../../shared" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + GeneratePreprocessedFile="0" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="2" @@ -32,20 +33,25 @@ BrowseInformation="1" WarningLevel="3" Detect64BitPortabilityProblems="FALSE" - DebugInformationFormat="4"/> + DebugInformationFormat="4" + CompileAs="1"/> @@ -92,6 +98,7 @@ makelib.bat win32.rel AdditionalDependencies="sdlmain.lib sdl.lib zlib.lib" OutputFile="$(OutDir)/stub.exe" LinkIncremental="1" + ModuleDefinitionFile="stub.def" GenerateDebugInformation="TRUE" SubSystem="2" OptimizeReferences="2" @@ -137,6 +144,7 @@ makelib.bat win32.rel AdditionalDependencies="sdlmain.lib sdl.lib zlib.lib" OutputFile="../../../bin/stub.exe" LinkIncremental="2" + ModuleDefinitionFile="stub.def" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/stub.pdb" SubSystem="1" @@ -186,6 +194,7 @@ makelib.bat win32.dbg AdditionalDependencies="sdlmain.lib sdl.lib zlib.lib" OutputFile="$(OutDir)/stub.exe" LinkIncremental="1" + ModuleDefinitionFile="stub.def" GenerateDebugInformation="TRUE" SubSystem="1" OptimizeReferences="2"