Import inicial

This commit is contained in:
Víctor Román Archidona 2002-12-18 12:28:56 +00:00
parent 71805a9588
commit 6df0feb6b6
49 changed files with 6636 additions and 0 deletions

47
dlls/src/dinmem/dinmem.c Normal file
View file

@ -0,0 +1,47 @@
#include <export.h>
#include "dinmem.h"
/*
* POR HACER: eDIV debe controlar todas las peticiones de memoria dinámica
* es decir, si hacemos un free() donde no debemos, debe producirse un
* fp->Runtime_Error
*/
int ExportaFuncs(EXPORTAFUNCS_PARAMS)
{
FUNCTION("malloc",1,eDiv_Malloc) ;
FUNCTION("free",1,eDiv_Free) ;
return TRUE ;
}
int eDiv_Malloc(FUNCTION_PARAMS)
{
int longitud ;
int *puntero ;
longitud = getparm() ;
puntero = calloc(longitud,4) ;
if ( puntero == NULL ) {
fp->Runtime_Error(100); /* no hay memoria suficiente */
return 0 ;
}
else
return ( puntero - fp->mem ) ;
}
int eDiv_Free(FUNCTION_PARAMS)
{
int offset ;
int *puntero ;
offset = getparm() ;
puntero = &fp->mem[offset] ;
free( puntero ) ;
return 1 ;
}

View file

@ -0,0 +1,3 @@
LIBRARY dinmem
EXPORTS
ExportaFuncs

7
dlls/src/dinmem/dinmem.h Normal file
View file

@ -0,0 +1,7 @@
#ifndef __EDIV_DINMEM_H_
#define __EDIV_DINMEM_H_
int eDiv_Malloc(FUNCTION_PARAMS) ;
int eDiv_Free(FUNCTION_PARAMS) ;
#endif

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dinmem", "dinmem.vcproj", "{2FD59E33-AB54-47EC-A3E5-3619A3921ABF}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{2FD59E33-AB54-47EC-A3E5-3619A3921ABF}.Debug.ActiveCfg = Debug|Win32
{2FD59E33-AB54-47EC-A3E5-3619A3921ABF}.Debug.Build.0 = Debug|Win32
{2FD59E33-AB54-47EC-A3E5-3619A3921ABF}.Release.ActiveCfg = Release|Win32
{2FD59E33-AB54-47EC-A3E5-3619A3921ABF}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,137 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="dinmem"
ProjectGUID="{2FD59E33-AB54-47EC-A3E5-3619A3921ABF}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DINMEM_EXPORTS"
MinimalRebuild="FALSE"
ExceptionHandling="FALSE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/dinmem.dll"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile="../dinmem.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/dinmem.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/dinmem.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DINMEM_EXPORTS"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/dinmem.dll"
LinkIncremental="1"
ModuleDefinitionFile="../dinmem.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/dinmem.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="codigo"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\dinmem.c">
</File>
</Filter>
<Filter
Name="cabeceras"
Filter="h;hpp;hxx;hm;inl;inc">
<File
RelativePath="..\dinmem.h">
</File>
</Filter>
<Filter
Name="definiciones"
Filter="def;">
<File
RelativePath="..\dinmem.def">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

356
dlls/src/edivstd/edivstd.c Normal file
View file

@ -0,0 +1,356 @@
/*
* eDiv Compiler
* Copyleft (C) 2000-2002 Sion Entertainment
* http://www.sion-e.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
*EDIVSTD.DLL
* Esta librería contiene los datos más básicos que puede requerir un programa
* DIV, tal como las opciones de compilación, estructura reserved, etc.
*/
#ifdef _WIN32
#include <time.h>
#include <sys/timeb.h>
unsigned int tiempo;
unsigned int ultimo_tiempo;
#else
#error ¡adapta las rutinas de timer a Linux!
#endif
#include <stdio.h>
#include "export.h"
#include "edivstd.h"
int last_type ;
int last_proc ;
int ExportaFuncs(EXPORTAFUNCS_PARAMS)
{
/* CONSTANTES PREDEFINIDAS */
/* Opciones de compilación */
CONST("_max_process",0);
CONST("_extended_conditions",1);
CONST("_simple_conditions",2);
CONST("_case_sensitive",3);
CONST("_ignore_errors",4);
CONST("_free_sintax",5);
CONST("_no_check",6);
CONST("_no_strfix",7);
CONST("_no_optimization",8);
CONST("_no_range_check",9);
CONST("_no_id_check",10);
CONST("_no_null_check",11);
/* Indicadores de ventanas (cnumber) */
CONST("c_0",1);
CONST("c_1",2);
CONST("c_2",4);
CONST("c_3",8);
CONST("c_4",16);
CONST("c_5",32);
CONST("c_6",64);
CONST("c_7",128);
CONST("c_8",256);
CONST("c_9",512);
/* True y false */
CONST("true",1);
CONST("false",0);
/* Rango de INT */
CONST("max_int",2147483647);
CONST("min_int",-2147483648);
/* Señales entre procesos */
CONST("s_kill",0);
CONST("s_wakeup",1);
CONST("s_sleep",2);
CONST("s_freeze",3);
CONST("s_kill_tree",100);
CONST("s_wakeup_tree",101);
CONST("s_sleep_tree",102);
CONST("s_freeze_tree",103);
/* DATOS GLOBALES PREDEFINIDOS */
/* Contadores de tiempo */
GLOBAL_ARRAY("timer",9);
/* Tiempo máximo de ejecución para un proceso */
GLOBAL("max_process_time",500);
/* Argumentos de línea de comando */
GLOBAL("argc",0);
GLOBAL_ARRAY("argv",9);
/* DATOS LOCALES PREDEFINIDOS */
/* Estructura reserved - POR HACER: ¿preservar compatibilidad con DIV? -> si
* pero ¿Qué hacer con distance_1 y distance_2 (sinónimos de m8_object y old_ctype,
* respectivamente)? ya nos toparemos con ellas cuando hagamos el modo7.
*/
LOCAL_STRUCT("reserved",0);
_INT("process_id",0);
_INT("id_scan",0);
_INT("process_type",0); /* usado por VisualDIV ;) */
_INT("type_scan",0);
_INT("status",2);
_INT("parameters",0);
_INT("param_offset",0);
_INT("program_index",0);
_INT("stack_pointer",0);
_INT("is_executed",0);
_INT("is_painted",0);
_INT("m8_object",-1); /* usado por VPE en DIV2 */
_INT("old_ctype",0);
_INT("frame_percent",0);
_INT("box_x0",0);
_INT("box_y0",0);
_INT("box_x1",0);
_INT("box_y1",0);
_INT("f_count",0);
_INT("caller_id",0);
END_STRUCT;
/* Jerarquía de procesos */
LOCAL("father",0);
LOCAL("son",0);
LOCAL("smallbro",0);
LOCAL("bigbro",0);
/* Variables locales varias */
LOCAL("priority",0);
LOCAL("ctype",0);
LOCAL("x",0);
LOCAL("y",0);
LOCAL("z",0);
LOCAL("graph",0);
LOCAL("size",0);
LOCAL("angle",0);
LOCAL("region",0);
LOCAL("file",0);
LOCAL("xgraph",0);
LOCAL("height",1);
LOCAL("cnumber",0);
LOCAL("resolution",0);
LOCAL("flags",0);
LOCAL("transparency",128) ;
FUNCTION("exit",2,eDIV_Exit);
FUNCTION("get_id",1,eDiv_GetId) ;
FUNCTION("define_region",5,eDiv_DefineRegion) ;
FUNCTION("signal",2,eDIV_Signal);
FUNCTION("let_me_alone",0,eDIV_Let_Me_Alone);
ENTRYPOINT( first_load ) ;
ENTRYPOINT(frame);
/*
* POR HACER: funciones signal, system, ignore_error...
*/
return TRUE;
}
int eDIV_Exit(FUNCTION_PARAMS)
{
int codigo=getparm();
char* mensaje=getstrparm();
/*
* FIXME: ¿Qué hacemos con el mensaje? ¿Lo mostramos en un msgbox si no es ""?
*/
if(*mensaje) {
#ifdef _WIN32
MessageBox(0,mensaje,fp->nombre_program,0);
#else
fprintf(stdout,"%s\n",mensaje);
#endif
}
#ifdef _DEBUG
printf("dbg:\texit(): código de retorno: %d\n",codigo);
#endif
fp->Stub_Quit(codigo);
/* Por si acaso :P */
return codigo;
}
int eDiv_GetId(FUNCTION_PARAMS)
{
int i ,id1 ;
int a = getparm() ;
int* last_type=&reserved("type_scan",fp->procs_s[fp->proc_orden[*fp->proceso_actual]].id);
int* last_proc=&reserved("id_scan",fp->procs_s[fp->proc_orden[*fp->proceso_actual]].id);
if ( *last_type == a )
i = *last_proc+1 ;
else {
i = 0 ;
*last_type = a ;
}
for ( ; i < *fp->num_procs ; i++ )
{
*last_proc = i ;
id1 = fp->procs_s[ fp->proc_orden[ i ] ].id ;
/* Si el proceso se corresponde con el type */
if ( reserved("process_type",id1) == a )
{
return ( fp->procs_s[ fp->proc_orden[ i ] ].id ) ;
}
}
*last_type = 0 ;
return 0 ;
}
int eDiv_DefineRegion(FUNCTION_PARAMS)
{
int n , x , y , w , h ;
h = getparm() ;
w = getparm() ;
y = getparm() ;
x = getparm() ;
n = getparm() ;
if ( n > 31 || n < 1 ) {
fp->Runtime_Error(108); /* nº de región inválido */
return 0;
}
regions[n].x = x ;
regions[n].y = y ;
regions[n].w = w ;
regions[n].h = h ;
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",id2)=signal;
}
while(local("bigbro",id2)) {
proc=local("bigbro",id2);
reserved("status",id2)=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);
}
}
}
return 0;
}
int eDIV_Let_Me_Alone(FUNCTION_PARAMS)
{
int i;
int _status=reservedptr("status");
for(i=0;i<*fp->num_procs;i++) {
if(i!=*fp->proceso_actual) {
fp->mem[fp->procs_s[fp->proc_orden[i]].id+_status]=1; /* s_kill */
}
}
return 0;
}
/*
* Entrypoints
*/
void first_load(FUNCTION_PARAMS)
{
int i ;
#ifdef _WIN32
struct timeb tiempob;
ftime(&tiempob);
ultimo_tiempo=tiempob.time*100+tiempob.millitm/10;
#endif
for ( i = 0 ; i < 32 ; i++ )
{
regions[i].x = 0 ;
regions[i].y = 0 ;
regions[i].w = 0 ;
regions[i].h = 0 ;
}
fp->regions = regions ;
fp->existe.regions = 1 ;
}
void frame(FUNCTION_PARAMS)
{
int i;
int timer;
#ifdef _WIN32
struct timeb tiempob;
ftime(&tiempob);
tiempo=tiempob.time*100+tiempob.millitm/10;
timer=globalptr("timer");
for(i=0;i<10;i++)
fp->mem[timer+i]+=tiempo-ultimo_tiempo;
ultimo_tiempo=tiempo;
#endif
}

View file

@ -0,0 +1,3 @@
LIBRARY edivstd
EXPORTS
ExportaFuncs

View file

@ -0,0 +1,13 @@
#ifndef __EDIV_EDIVSTD_H_
#define __EDIV_EDIVSTD_H_
struct _regions regions[32] ;
/* Prototipos */
int eDIV_Exit(FUNCTION_PARAMS);
int eDiv_GetId(FUNCTION_PARAMS) ;
int eDiv_DefineRegion(FUNCTION_PARAMS) ;
int eDIV_Signal(FUNCTION_PARAMS);
int eDIV_Let_Me_Alone(FUNCTION_PARAMS);
#endif

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "edivstd", "edivstd.vcproj", "{92B930FB-7B7F-4DD6-A50C-8DE8E34461C2}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{92B930FB-7B7F-4DD6-A50C-8DE8E34461C2}.Debug.ActiveCfg = Debug|Win32
{92B930FB-7B7F-4DD6-A50C-8DE8E34461C2}.Debug.Build.0 = Debug|Win32
{92B930FB-7B7F-4DD6-A50C-8DE8E34461C2}.Release.ActiveCfg = Release|Win32
{92B930FB-7B7F-4DD6-A50C-8DE8E34461C2}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="edivstd"
ProjectGUID="{92B930FB-7B7F-4DD6-A50C-8DE8E34461C2}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;EDIVSTD_EXPORTS"
MinimalRebuild="TRUE"
ExceptionHandling="FALSE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/edivstd.dll"
LinkIncremental="2"
ModuleDefinitionFile="../edivstd.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/edivstd.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/edivstd.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;EDIVSTD_EXPORTS"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/edivstd.dll"
LinkIncremental="1"
ModuleDefinitionFile="../edivstd.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/edivstd.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="codigo"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\edivstd.c">
</File>
</Filter>
<Filter
Name="cabeceras"
Filter="h;hpp;hxx;hm;inl;inc">
<File
RelativePath="..\edivstd.h">
</File>
</Filter>
<Filter
Name="definiciones"
Filter="def;">
<File
RelativePath="..\edivstd.def">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

174
dlls/src/file/file.c Normal file
View file

@ -0,0 +1,174 @@
#include <stdio.h>
#include <errno.h>
#include <export.h>
#include "file.h"
int ExportaFuncs(EXPORTAFUNCS_PARAMS)
{
CONST("seek_cur",SEEK_CUR) ;
CONST("seek_set",SEEK_SET) ;
CONST("seek_end",SEEK_END) ;
GLOBAL("unit_size",4);
FUNCTION("fopen",2,eDiv_Fopen) ;
FUNCTION("fwrite",3,eDiv_Fwrite) ;
FUNCTION("fread",3,eDiv_Fread) ;
FUNCTION("ftell",1,eDiv_Ftell) ;
FUNCTION("fseek",3,eDiv_Fseek) ;
FUNCTION("flush",0,eDiv_Flush) ;
FUNCTION("fclose",1,eDiv_Fclose) ;
return TRUE ;
}
FILE *fichero[0xFF] ;
int existe[0xFF] ;
/*
* POR HACER:
* Los handles deben ser IMPARES
*/
int eDiv_Fopen(FUNCTION_PARAMS)
{
int i ;
char *filename ;
char modo[128];
strcpy(modo,getstrparm());
filename = getstrparm() ;
for (i=0;i<strlen(modo);i++)
if (modo[i]!='r' && modo[i]!='w' && modo[i]!='a' && modo[i]!='+') break;
if (i<strlen(modo)) {
fp->Runtime_Error(166); /* modo de acceso al archivo no válido */
return 0;
}
strcat(modo,"b");
for ( i = 1 ; i < 0xFF ; i++ )
if ( existe[i] == 0 )
break ;
if ( i == 0xFF ) {
fp->Runtime_Error(169); /* demasiados archivos abiertos */
return 0 ;
}
fichero[i] = fopen( filename, modo ) ;
if ( fichero[i] == NULL ) {
if(errno==EMFILE)
fp->Runtime_Error(169); /* demasiados archivos abiertos */
return 0 ;
}
existe[i] = 1 ;
return i;
}
int eDiv_Fwrite(FUNCTION_PARAMS)
{
int offset , longitud , handle ;
int escrito ;
handle = getparm() ;
longitud = getparm() ;
offset = getparm() ;
if ( !existe[handle] ) {
fp->Runtime_Error(170); /* handle no válido */
return 0;
}
escrito = fwrite( &fp->mem[ offset ] , global("unit_size") , longitud , fichero[handle] ) ;
if ( escrito == longitud )
return 1 ;
else
return 0 ;
}
int eDiv_Fread(FUNCTION_PARAMS)
{
int offset, longitud , handle ;
int leido ;
handle = getparm() ;
longitud = getparm() ;
offset = getparm() ;
if ( !existe[handle] )
return 0 ;
leido = fread( &fp->mem[ offset ] , global("unit_size") , longitud , fichero[handle] ) ;
if ( leido == longitud )
return 1 ;
else
return 0 ;
}
int eDiv_Ftell(FUNCTION_PARAMS)
{
int handle=getparm();
if ( !existe[handle] ) {
fp->Runtime_Error(170); /* handle no válido */
return -1 ; /* En caso de error, DIV2 devuelve handle, pero no me parece muy correcto... */
}
return (int)ftell( fichero[handle] ) ;
}
int eDiv_Fseek(FUNCTION_PARAMS)
{
int handle , posicion, modo ;
modo = getparm() ;
posicion = getparm()*global("unit_size") ;
handle = getparm() ;
if ( !existe[handle] ) {
fp->Runtime_Error(170); /* handle no válido */
return -1 ; /* ocurre lo mismo que con ftell... */
}
if ( fseek( fichero[handle] , posicion , modo ) == 0 )
return 0 ;
else
return -1 ;
}
int eDiv_Flush(FUNCTION_PARAMS)
{
return flushall() ; /* flushall()-numfiles */
}
int eDiv_Fclose(FUNCTION_PARAMS)
{
int handle=getparm(), num ;
if ( handle == 0 )
if ( ( num = fcloseall() ) == EOF )
return 0 ;
else
return num ;
else
if ( !existe[handle] ) {
fp->Runtime_Error(170);
return 0 ;
}
else
if ( ( num = fclose( fichero[handle] ) ) == EOF )
return 0 ;
else
return num ;
}

3
dlls/src/file/file.def Normal file
View file

@ -0,0 +1,3 @@
LIBRARY file
EXPORTS
ExportaFuncs

12
dlls/src/file/file.h Normal file
View file

@ -0,0 +1,12 @@
#ifndef __EDIV_FILE_H_
#define __EDIV_FILE_H_
int eDiv_Fopen(FUNCTION_PARAMS) ;
int eDiv_Fwrite(FUNCTION_PARAMS) ;
int eDiv_Fread(FUNCTION_PARAMS) ;
int eDiv_Ftell(FUNCTION_PARAMS) ;
int eDiv_Fseek(FUNCTION_PARAMS) ;
int eDiv_Flush(FUNCTION_PARAMS) ;
int eDiv_Fclose(FUNCTION_PARAMS) ;
#endif

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "file", "file.vcproj", "{EA869297-5AC6-4603-BB86-9962207DB25F}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{EA869297-5AC6-4603-BB86-9962207DB25F}.Debug.ActiveCfg = Debug|Win32
{EA869297-5AC6-4603-BB86-9962207DB25F}.Debug.Build.0 = Debug|Win32
{EA869297-5AC6-4603-BB86-9962207DB25F}.Release.ActiveCfg = Release|Win32
{EA869297-5AC6-4603-BB86-9962207DB25F}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="file"
ProjectGUID="{EA869297-5AC6-4603-BB86-9962207DB25F}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FILE_EXPORTS"
MinimalRebuild="TRUE"
ExceptionHandling="FALSE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/file.dll"
LinkIncremental="2"
ModuleDefinitionFile="../file.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/file.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/file.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FILE_EXPORTS"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/file.dll"
LinkIncremental="1"
ModuleDefinitionFile="../file.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/file.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="codigo"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\file.c">
</File>
</Filter>
<Filter
Name="cabeceras"
Filter="h;hpp;hxx;hm;inl;inc">
<File
RelativePath="..\file.h">
</File>
</Filter>
<Filter
Name="definiciones"
Filter="def;">
<File
RelativePath="..\file.def">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,901 @@
/*
SDL_rotozoom.c
Copyright (C) A. Schiffler, July 2001
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef WIN32
#include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "SDL_rotozoom.h"
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
/*
32bit Zoomer with optional anti-aliasing by bilinear interpolation.
Zoomes 32bit RGBA/ABGR 'src' surface to 'dst' surface.
*/
int
zoomSurfaceRGBA (SDL_Surface * src, SDL_Surface * dst, int smooth)
{
int x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy, ex, ey, t1, t2, sstep;
tColorRGBA *c00, *c01, *c10, *c11;
tColorRGBA *sp, *csp, *dp;
int sgap, dgap, orderRGBA;
/* Variable setup */
if (smooth)
{
/* For interpolation: assume source dimension is one pixel */
/* smaller to avoid overflow on right and bottom edge. */
sx = (int) (65536.0 * (float) (src->w - 1) / (float) dst->w);
sy = (int) (65536.0 * (float) (src->h - 1) / (float) dst->h);
}
else
{
sx = (int) (65536.0 * (float) src->w / (float) dst->w);
sy = (int) (65536.0 * (float) src->h / (float) dst->h);
}
/* Allocate memory for row increments */
if ((sax = (int *) malloc ((dst->w + 1) * sizeof (Uint32))) == NULL)
{
return (-1);
}
if ((say = (int *) malloc ((dst->h + 1) * sizeof (Uint32))) == NULL)
{
free (sax);
return (-1);
}
/* Precalculate row increments */
csx = 0;
csax = sax;
for (x = 0; x <= dst->w; x++)
{
*csax = csx;
csax++;
csx &= 0xffff;
csx += sx;
}
csy = 0;
csay = say;
for (y = 0; y <= dst->h; y++)
{
*csay = csy;
csay++;
csy &= 0xffff;
csy += sy;
}
/* Pointer setup */
sp = csp = (tColorRGBA *) src->pixels;
dp = (tColorRGBA *) dst->pixels;
sgap = src->pitch - src->w * 4;
dgap = dst->pitch - dst->w * 4;
orderRGBA = (src->format->Rmask == 0x000000ff);
/* Switch between interpolating and non-interpolating code */
if (smooth)
{
/* Interpolating Zoom */
/* Scan destination */
csay = say;
for (y = 0; y < dst->h; y++)
{
/* Setup color source pointers */
c00 = csp;
c01 = csp;
c01++;
c10 = (tColorRGBA *) ((Uint8 *) csp + src->pitch);
c11 = c10;
c11++;
csax = sax;
for (x = 0; x < dst->w; x++)
{
/* ABGR ordering */
/* Interpolate colors */
ex = (*csax & 0xffff);
ey = (*csay & 0xffff);
t1 = ((((c01->r - c00->r) * ex) >> 16) + c00->r) & 0xff;
t2 = ((((c11->r - c10->r) * ex) >> 16) + c10->r) & 0xff;
dp->r = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->g - c00->g) * ex) >> 16) + c00->g) & 0xff;
t2 = ((((c11->g - c10->g) * ex) >> 16) + c10->g) & 0xff;
dp->g = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->b - c00->b) * ex) >> 16) + c00->b) & 0xff;
t2 = ((((c11->b - c10->b) * ex) >> 16) + c10->b) & 0xff;
dp->b = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->a - c00->a) * ex) >> 16) + c00->a) & 0xff;
t2 = ((((c11->a - c10->a) * ex) >> 16) + c10->a) & 0xff;
dp->a = (((t2 - t1) * ey) >> 16) + t1;
/* Advance source pointers */
csax++;
sstep = (*csax >> 16);
c00 += sstep;
c01 += sstep;
c10 += sstep;
c11 += sstep;
/* Advance destination pointer */
dp++;
}
/* Advance source pointer */
csay++;
csp = (tColorRGBA *) ((Uint8 *) csp + (*csay >> 16) * src->pitch);
/* Advance destination pointers */
dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
}
}
else
{
/* Non-Interpolating Zoom */
csay = say;
for (y = 0; y < dst->h; y++)
{
sp = csp;
csax = sax;
for (x = 0; x < dst->w; x++)
{
/* Draw */
*dp = *sp;
/* Advance source pointers */
csax++;
sp += (*csax >> 16);
/* Advance destination pointer */
dp++;
}
/* Advance source pointer */
csay++;
csp = (tColorRGBA *) ((Uint8 *) csp + (*csay >> 16) * src->pitch);
/* Advance destination pointers */
dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
}
}
/* Remove temp arrays */
free (sax);
free (say);
return (0);
}
/*
8bit Zoomer without smoothing.
Zoomes 8bit palette/Y 'src' surface to 'dst' surface.
*/
int
zoomSurfaceY (SDL_Surface * src, SDL_Surface * dst)
{
Uint32 x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy;
Uint8 *sp, *dp, *csp;
int dgap;
/* Variable setup */
sx = (Uint32) (65536.0 * (float) src->w / (float) dst->w);
sy = (Uint32) (65536.0 * (float) src->h / (float) dst->h);
/* Allocate memory for row increments */
if ((sax = (Uint32 *) malloc (dst->w * sizeof (Uint32))) == NULL)
{
return (-1);
}
if ((say = (Uint32 *) malloc (dst->h * sizeof (Uint32))) == NULL)
{
if (sax != NULL)
{
free (sax);
}
return (-1);
}
/* Precalculate row increments */
csx = 0;
csax = sax;
for (x = 0; x < dst->w; x++)
{
csx += sx;
*csax = (csx >> 16);
csx &= 0xffff;
csax++;
}
csy = 0;
csay = say;
for (y = 0; y < dst->h; y++)
{
csy += sy;
*csay = (csy >> 16);
csy &= 0xffff;
csay++;
}
csx = 0;
csax = sax;
for (x = 0; x < dst->w; x++)
{
csx += (*csax);
csax++;
}
csy = 0;
csay = say;
for (y = 0; y < dst->h; y++)
{
csy += (*csay);
csay++;
}
/* Pointer setup */
sp = csp = (Uint8 *) src->pixels;
dp = (Uint8 *) dst->pixels;
dgap = dst->pitch - dst->w;
/* Draw */
csay = say;
for (y = 0; y < dst->h; y++)
{
csax = sax;
sp = csp;
for (x = 0; x < dst->w; x++)
{
/* Draw */
*dp = *sp;
/* Advance source pointers */
sp += (*csax);
csax++;
/* Advance destination pointer */
dp++;
}
/* Advance source pointer (for row) */
csp += ((*csay) * src->pitch);
csay++;
/* Advance destination pointers */
dp += dgap;
}
/* Remove temp arrays */
free (sax);
free (say);
return (0);
}
/*
32bit Rotozoomer with optional anti-aliasing by bilinear interpolation.
Rotates and zoomes 32bit RGBA/ABGR 'src' surface to 'dst' surface.
*/
void
transformSurfaceRGBA (SDL_Surface * src, SDL_Surface * dst, int cx, int cy,
int isin, int icos, int smooth)
{
int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
tColorRGBA c00, c01, c10, c11;
tColorRGBA *pc, *sp;
int gap, orderRGBA;
xd = ((src->w - dst->w) << 15);
yd = ((src->h - dst->h) << 15);
ax = (cx << 16) - (icos * cx);
ay = (cy << 16) - (isin * cx);
sw = src->w - 1;
sh = src->h - 1;
pc = dst->pixels;
gap = dst->pitch - dst->w * 4;
orderRGBA = (src->format->Rmask == 0x000000ff);
if (smooth)
{
for (y = 0; y < dst->h; y++)
{
dy = cy - y;
sdx = (ax + (isin * dy)) + xd;
sdy = (ay - (icos * dy)) + yd;
for (x = 0; x < dst->w; x++)
{
dx = (sdx >> 16);
dy = (sdy >> 16);
if ((dx >= -1) && (dy >= -1) && (dx < src->w) && (dy < src->h))
{
if ((dx >= 0) && (dy >= 0) && (dx < sw) && (dy < sh))
{
sp =
(tColorRGBA *) ((Uint8 *) src->pixels +
src->pitch * dy);
sp += dx;
c00 = *sp;
sp += 1;
c01 = *sp;
sp = (tColorRGBA *) ((Uint8 *) sp + src->pitch);
sp -= 1;
c10 = *sp;
sp += 1;
c11 = *sp;
}
else if ((dx == sw) && (dy == sh))
{
sp =
(tColorRGBA *) ((Uint8 *) src->pixels +
src->pitch * dy);
sp += dx;
c00 = *sp;
c01 = *pc;
c10 = *pc;
c11 = *pc;
}
else if ((dx == -1) && (dy == -1))
{
sp = (tColorRGBA *) (src->pixels);
c00 = *pc;
c01 = *pc;
c10 = *pc;
c11 = *sp;
}
else if ((dx == -1) && (dy == sh))
{
sp = (tColorRGBA *) (src->pixels);
sp =
(tColorRGBA *) ((Uint8 *) src->pixels +
src->pitch * dy);
c00 = *pc;
c01 = *sp;
c10 = *pc;
c11 = *pc;
}
else if ((dx == sw) && (dy == -1))
{
sp = (tColorRGBA *) (src->pixels);
sp += dx;
c00 = *pc;
c01 = *pc;
c10 = *sp;
c11 = *pc;
}
else if (dx == -1)
{
sp =
(tColorRGBA *) ((Uint8 *) src->pixels +
src->pitch * dy);
c00 = *pc;
c01 = *sp;
c10 = *pc;
sp = (tColorRGBA *) ((Uint8 *) sp + src->pitch);
c11 = *sp;
}
else if (dy == -1)
{
sp = (tColorRGBA *) (src->pixels);
sp += dx;
c00 = *pc;
c01 = *pc;
c10 = *sp;
sp += 1;
c11 = *sp;
}
else if (dx == sw)
{
sp =
(tColorRGBA *) ((Uint8 *) src->pixels +
src->pitch * dy);
sp += dx;
c00 = *sp;
c01 = *pc;
sp = (tColorRGBA *) ((Uint8 *) sp + src->pitch);
c10 = *sp;
c11 = *pc;
}
else if (dy == sh)
{
sp =
(tColorRGBA *) ((Uint8 *) src->pixels +
src->pitch * dy);
sp += dx;
c00 = *sp;
sp += 1;
c01 = *sp;
c10 = *pc;
c11 = *pc;
}
ex = (sdx & 0xffff);
ey = (sdy & 0xffff);
t1 = ((((c01.r - c00.r) * ex) >> 16) + c00.r) & 0xff;
t2 = ((((c11.r - c10.r) * ex) >> 16) + c10.r) & 0xff;
pc->r = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01.g - c00.g) * ex) >> 16) + c00.g) & 0xff;
t2 = ((((c11.g - c10.g) * ex) >> 16) + c10.g) & 0xff;
pc->g = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01.b - c00.b) * ex) >> 16) + c00.b) & 0xff;
t2 = ((((c11.b - c10.b) * ex) >> 16) + c10.b) & 0xff;
pc->b = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01.a - c00.a) * ex) >> 16) + c00.a) & 0xff;
t2 = ((((c11.a - c10.a) * ex) >> 16) + c10.a) & 0xff;
pc->a = (((t2 - t1) * ey) >> 16) + t1;
}
sdx += icos;
sdy += isin;
pc++;
}
pc = (tColorRGBA *) ((Uint8 *) pc + gap);
}
}
else
{
for (y = 0; y < dst->h; y++)
{
dy = cy - y;
sdx = (ax + (isin * dy)) + xd;
sdy = (ay - (icos * dy)) + yd;
for (x = 0; x < dst->w; x++)
{
dx = (short) (sdx >> 16);
dy = (short) (sdy >> 16);
if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h))
{
sp =
(tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy);
sp += dx;
*pc = *sp;
}
sdx += icos;
sdy += isin;
pc++;
}
pc = (tColorRGBA *) ((Uint8 *) pc + gap);
}
}
}
/*
8bit Rotozoomer without smoothing
Rotates and zoomes 8bit palette/Y 'src' surface to 'dst' surface.
*/
void
transformSurfaceY (SDL_Surface * src, SDL_Surface * dst, int cx, int cy,
int isin, int icos)
{
int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay, sw, sh;
tColorY *pc, *sp;
int gap;
/* Variable setup */
xd = ((src->w - dst->w) << 15);
yd = ((src->h - dst->h) << 15);
ax = (cx << 16) - (icos * cx);
ay = (cy << 16) - (isin * cx);
sw = src->w - 1;
sh = src->h - 1;
pc = dst->pixels;
gap = dst->pitch - dst->w;
/* Clear surface to colorkey */
memset (pc, (unsigned char) (src->format->colorkey & 0xff),
dst->pitch * dst->h);
/* Iterate through destination surface */
for (y = 0; y < dst->h; y++)
{
dy = cy - y;
sdx = (ax + (isin * dy)) + xd;
sdy = (ay - (icos * dy)) + yd;
for (x = 0; x < dst->w; x++)
{
dx = (short) (sdx >> 16);
dy = (short) (sdy >> 16);
if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h))
{
sp = (tColorY *) (src->pixels);
sp += (src->pitch * dy + dx);
*pc = *sp;
}
sdx += icos;
sdy += isin;
pc++;
}
pc += gap;
}
}
/*
rotozoomSurface()
Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1
then the destination 32bit surface is anti-aliased. If the surface is not 8bit
or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
*/
/*XPUT/* Sanity check */
/* Determine if source surface is 32bit or 8bit */
/* New source surface is 32bit with a defined RGBA ordering */
/* Sanity check zoom factor */
/* Check if we have a rotozoom or just a zoom */
/* Angle!=0: full rotozoom *
//* ----------------------- */
/* Calculate target factors from sin/cos and zoom
*/
/* Determine destination width and height by rotating a centered source box */
/* Alloc space to completely contain the rotated surface */
/* Target surface is 32bit with source RGBA/ABGR ordering */
/* Lock source surface */
/* Check which kind of surface we have */
/* Call the 32bit transformation routine to do the rotation (using alpha) */
#define VALUE_LIMIT 0.001
SDL_Surface *
rotozoomSurface (SDL_Surface * src, double angle, double zoom, int smooth)
{
SDL_Surface *rz_src;
SDL_Surface *rz_dst;
double zoominv;
double radangle, sanglezoom, canglezoom, sanglezoominv, canglezoominv;
int dstwidthhalf, dstwidth, dstheighthalf, dstheight;
double x, y, cx, cy, sx, sy;
int is32bit;
int i, src_converted;
if (src == NULL)
return (NULL);
is32bit = (src->format->BitsPerPixel == 32);
if ((is32bit) || (src->format->BitsPerPixel == 8))
{
rz_src = src;
src_converted = 0;
}
else
{
rz_src =
SDL_CreateRGBSurface (SDL_SWSURFACE, src->w, src->h, 32, 0x000000ff,
0x0000ff00, 0x00ff0000, 0xff000000);
SDL_BlitSurface (src, NULL, rz_src, NULL);
src_converted = 1;
is32bit = 1;
}
if (zoom < VALUE_LIMIT)
{
zoom = VALUE_LIMIT;
}
zoominv = 65536.0 / zoom;
if (fabs (angle) > VALUE_LIMIT)
{
radangle = angle * (M_PI / 180.0);
sanglezoom = sanglezoominv = sin (radangle);
canglezoom = canglezoominv = cos (radangle);
sanglezoom *= zoom;
canglezoom *= zoom;
sanglezoominv *= zoominv;
canglezoominv *= zoominv;
x = rz_src->w / 2;
y = rz_src->h / 2;
cx = canglezoom * x;
cy = canglezoom * y;
sx = sanglezoom * x;
sy = sanglezoom * y;
dstwidthhalf = src->w;
dstheighthalf = src->h;
/*dstwidthhalf =MAX ((int)
ceil (MAX
(MAX
(MAX (fabs (cx + sy), fabs (cx - sy)), fabs (-cx + sy)),
fabs (-cx - sy))), 1);
dstheighthalf = MAX ((int) ceil (MAX (MAX (MAX (fabs (sx + cy), fabs (sx - cy)), fabs (-sx + cy)),fabs (-sx - cy))), 1);
*/
dstwidth = 2 * dstwidthhalf;
dstheight = 2 * dstheighthalf;
rz_dst = NULL;
if (is32bit)
{
rz_dst =
SDL_CreateRGBSurface (SDL_SWSURFACE, dstwidth, dstheight, 32,
rz_src->format->Rmask,
rz_src->format->Gmask,
rz_src->format->Bmask,
rz_src->format->Amask);
}
else
{
rz_dst =
SDL_CreateRGBSurface (SDL_SWSURFACE, dstwidth, dstheight, 8, 0, 0,
0, 0);
}
SDL_LockSurface (rz_src);
if (is32bit)
{
transformSurfaceRGBA (rz_src, rz_dst, dstwidthhalf, dstheighthalf,
(int) (sanglezoominv),
(int) (canglezoominv), smooth);
SDL_SetAlpha (rz_dst, SDL_SRCALPHA, 255);
}
else
{
for (i = 0; i < rz_src->format->palette->ncolors; i++)
{
rz_dst->format->palette->colors[i] =
rz_src->format->palette->colors[i];
}
rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
transformSurfaceY (rz_src, rz_dst, dstwidthhalf, dstheighthalf,
(int) (sanglezoominv), (int) (canglezoominv));
SDL_SetColorKey (rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL,
rz_src->format->colorkey);
}
SDL_UnlockSurface (rz_src);
}
else
{
dstwidth = (int) ((double) rz_src->w * zoom);
dstheight = (int) ((double) rz_src->h * zoom);
if (dstwidth < 1)
{
dstwidth = 1;
}
if (dstheight < 1)
{
dstheight = 1;
}
rz_dst = NULL;
if (is32bit)
{
rz_dst =
SDL_CreateRGBSurface (SDL_SWSURFACE, dstwidth, dstheight, 32,
rz_src->format->Rmask,
rz_src->format->Gmask,
rz_src->format->Bmask,
rz_src->format->Amask);
}
else
{
rz_dst =
SDL_CreateRGBSurface (SDL_SWSURFACE, dstwidth, dstheight, 8, 0, 0,
0, 0);
}
SDL_LockSurface (rz_src);
if (is32bit)
{
zoomSurfaceRGBA (rz_src, rz_dst, smooth);
SDL_SetAlpha (rz_dst, SDL_SRCALPHA, 255);
}
else
{
for (i = 0; i < rz_src->format->palette->ncolors; i++)
{
rz_dst->format->palette->colors[i] =
rz_src->format->palette->colors[i];
}
rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
zoomSurfaceY (rz_src, rz_dst);
SDL_SetColorKey (rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL,
rz_src->format->colorkey);
}
SDL_UnlockSurface (rz_src);
}
if (src_converted)
{
SDL_FreeSurface (rz_src);
}
return (rz_dst);
}
/*
zoomSurface()
Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1
then the destination 32bit surface is anti-aliased. If the surface is not 8bit
or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
*/
#define VALUE_LIMIT 0.001
SDL_Surface *
zoomSurface (SDL_Surface * src, double zoomx, double zoomy, int smooth)
{
SDL_Surface *rz_src;
SDL_Surface *rz_dst;
int dstwidth, dstheight;
int is32bit;
int i, src_converted;
if (src == NULL)
return (NULL);
is32bit = (src->format->BitsPerPixel == 32);
if ((is32bit) || (src->format->BitsPerPixel == 8))
{
rz_src = src;
src_converted = 0;
}
else
{
rz_src =
SDL_CreateRGBSurface (SDL_SWSURFACE, src->w, src->h, 32, 0x000000ff,
0x0000ff00, 0x00ff0000, 0xff000000);
SDL_BlitSurface (src, NULL, rz_src, NULL);
src_converted = 1;
is32bit = 1;
}
if (zoomx < VALUE_LIMIT)
{
zoomx = VALUE_LIMIT;
}
if (zoomy < VALUE_LIMIT)
{
zoomy = VALUE_LIMIT;
}
dstwidth = (int) ((double) rz_src->w * zoomx);
dstheight = (int) ((double) rz_src->h * zoomy);
if (dstwidth < 1)
{
dstwidth = 1;
}
if (dstheight < 1)
{
dstheight = 1;
}
rz_dst = NULL;
if (is32bit)
{
rz_dst =
SDL_CreateRGBSurface (SDL_SWSURFACE, dstwidth, dstheight, 32,
rz_src->format->Rmask, rz_src->format->Gmask,
rz_src->format->Bmask, rz_src->format->Amask);
}
else
{
rz_dst =
SDL_CreateRGBSurface (SDL_SWSURFACE, dstwidth, dstheight, 8, 0, 0, 0,
0);
}
SDL_LockSurface (rz_src);
if (is32bit)
{
zoomSurfaceRGBA (rz_src, rz_dst, smooth);
SDL_SetAlpha (rz_dst, SDL_SRCALPHA, 255);
}
else
{
for (i = 0; i < rz_src->format->palette->ncolors; i++)
{
rz_dst->format->palette->colors[i] =
rz_src->format->palette->colors[i];
}
rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
zoomSurfaceY (rz_src, rz_dst);
SDL_SetColorKey (rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL,
rz_src->format->colorkey);
}
SDL_UnlockSurface (rz_src);
if (src_converted)
{
SDL_FreeSurface (rz_src);
}
return (rz_dst);
}
#ifdef NORL_WIN32
/* For DLL building under VC6 */
BOOL APIENTRY
DllMain (HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif

View file

@ -0,0 +1,77 @@
#ifndef _SDL_rotozoom_h
#define _SDL_rotozoom_h
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C"
{
#endif
#include <math.h>
#ifndef M_PI
#define M_PI 3.141592654
#endif
#include <SDL/SDL.h>
/* ---- Defines */
#define SMOOTHING_OFF 0
#define SMOOTHING_ON 1
/* ---- Structures */
typedef struct tColorRGBA
{
Uint8 r;
Uint8 g;
Uint8 b;
Uint8 a;
}
tColorRGBA;
typedef struct tColorY
{
Uint8 y;
}
tColorY;
/* ---- Prototypes */
/*
rotozoomSurface()
Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1
then the destination 32bit surface is anti-aliased. If the surface is not 8bit
or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
*/
SDL_Surface *rotozoomSurface (SDL_Surface * src, double angle, double zoom,
int smooth);
/*
zoomSurface()
Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1
then the destination 32bit surface is anti-aliased. If the surface is not 8bit
or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
*/
SDL_Surface *zoomSurface (SDL_Surface * src, double zoomx, double zoomy,
int smooth);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
};
#endif
#endif /* _SDL_rotozoom_h */

1501
dlls/src/graphics/graphics.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,3 @@
LIBRARY graphics
EXPORTS
ExportaFuncs

View file

@ -0,0 +1,44 @@
#ifndef __EDIV_GRAPHICS_H_
#define __EDIV_GRAPHICS_H_
#include <SDL/SDL.h>
#define PIOVER180 0.017453292519943295769236907684886
SDL_Surface *screen;
SDL_Surface *prueba;
int eDIV_LOAD_BMP(FUNCTION_PARAMS);
int eDIV_COLLISION(FUNCTION_PARAMS);
int eDIV_SET_TRANSPARENT_COLOR(FUNCTION_PARAMS);
int eDIV_GET_TRANSPARENT_COLOR(FUNCTION_PARAMS);
int eDIV_RGB(FUNCTION_PARAMS);
int eDIV_GET_RGB(FUNCTION_PARAMS);
int eDIV_ADVANCE(FUNCTION_PARAMS);
int eDIV_XADVANCE(FUNCTION_PARAMS) ;
int eDIV_MAP_BLOCK_COPY(FUNCION_PARMAS) ;
int eDIV_MAP_GET_PIXEL(FUNCION_PARMAS) ;
int eDIV_MAP_PUT(FUNCION_PARMAS) ;
int eDIV_MAP_PUT_PIXEL(FUNCTION_PARAMS);
int eDIV_PUT(FUNCTION_PARAMS);
int eDIV_PUT_PIXEL(FUNCTION_PARAMS);
int eDIV_PUT_SCREEN(FUNCION_PARAMS);
int eDIV_CLEAR_SCREEN(FUNCTION_PARAMS);
int eDIV_GET_PIXEL(FUNCTION_PARAMS);
int eDIV_NEW_MAP(FUNCTION_PARAMS) ;
int eDIV_SCREEN_COPY(FUNCTION_PARAMS) ;
int eDIV_OUT_REGION(FUNCTION_PARAMS) ;
int eDIV_DRAW(FUNCTION_PARAMS) ;
int eDIV_MOVE_DRAW(FUNCTION_PARAMS) ;
int eDIV_DELETE_DRAW(FUNCTION_PARAMS) ;
int eDIV_LOAD_FPG(FUNCTION_PARAMS) ;
int eDIV_GET_POINT(FUNCTION_PARAMS) ;
int eDIV_GET_REAL_POINT(FUNCTION_PARAMS) ;
int eDIV_GRAPHIC_INFO(FUNCTION_PARAMS) ;
int eDIV_FADE(FUNCTION_PARAMS) ;
int eDIV_XPUT(FUNCTION_PARAMS);
int Dibuja(SDL_Surface *src , SDL_Rect srcrect , SDL_Rect dstrect , int z , int trans,int size,int angle);
SDL_Surface *xput(SDL_Surface *src,double size,double angle);
#endif

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "graphics.vcproj", "{20CF9907-2F82-4A8C-A5FB-074F5F1BCB32}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{20CF9907-2F82-4A8C-A5FB-074F5F1BCB32}.Debug.ActiveCfg = Debug|Win32
{20CF9907-2F82-4A8C-A5FB-074F5F1BCB32}.Debug.Build.0 = Debug|Win32
{20CF9907-2F82-4A8C-A5FB-074F5F1BCB32}.Release.ActiveCfg = Release|Win32
{20CF9907-2F82-4A8C-A5FB-074F5F1BCB32}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,144 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="graphics"
ProjectGUID="{20CF9907-2F82-4A8C-A5FB-074F5F1BCB32}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GRAPHICS_EXPORTS"
MinimalRebuild="TRUE"
ExceptionHandling="FALSE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sdlmain.lib sdl.lib"
OutputFile="$(OutDir)/graphics.dll"
LinkIncremental="2"
ModuleDefinitionFile="../graphics.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/graphics.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/graphics.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GRAPHICS_EXPORTS"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sdlmain.lib sdl.lib"
OutputFile="$(OutDir)/graphics.dll"
LinkIncremental="1"
ModuleDefinitionFile="../graphics.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/graphics.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="codigo"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\SDL_rotozoom.c">
</File>
<File
RelativePath="..\graphics.c">
</File>
</Filter>
<Filter
Name="cabeceras"
Filter="h;hpp;hxx;hm;inl;inc">
<File
RelativePath="..\SDL_rotozoom.h">
</File>
<File
RelativePath="..\graphics.h">
</File>
</Filter>
<Filter
Name="definiciones"
Filter="def;">
<File
RelativePath="..\graphics.def">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

281
dlls/src/include/export.h Normal file
View file

@ -0,0 +1,281 @@
/*
* eDiv Compiler
* Copyleft (C) 2000-2002 Sion Entertainment
* http://www.sion-e.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Este fichero es la cabecera para las DLL's de eDIV.
* Para saber cómo se utiliza, consulte el eDIV SDK de la documentación de eDIV
* ESTE FICHERO -NO- HA DE SER MODIFICADO PARA CREAR DLLs, TAN SÓLO POR
* DESARROLLADORES DE eDIV. EN CASO DE SER MODIFICADO, SE PERDERÁ LA
* COMPATIBILIDAD CON eDIV Y EL RESTO DE DLLs.
* En caso de encontrar cualquier bug o anomalía en este archivo, por favor
* notifíquelo a Sion Entertainment en bugs@edivcentral.com
*/
#ifndef __EDIV_EXPORT_H_
#define __EDIV_EXPORT_H_
#ifdef __cplusplus
extern "C" {
#endif
/* COMPATIBILIDAD WIN <-> LINUX */
#ifdef _WIN32
# include <windows.h>
#else
#ifndef bool
typedef enum { FALSE, TRUE } bool;
#endif
#endif
/* VARINDEX */
typedef enum { v_global, v_reserved, v_local } tipo_t;
typedef struct {
unsigned char hash;
tipo_t tipo;
char* nombre;
int offset;
} varindex_t;
#define global(nombre) fp->mem[fp->GetVarOffset(v_global,nombre)]
#define reserved(nombre,id) fp->mem[(id)+fp->GetVarOffset(v_reserved,nombre)]
#define local(nombre,id) fp->mem[(id)+fp->GetVarOffset(v_local,nombre)]
#define globalptr(nombre) fp->GetVarOffset(v_global,nombre)
#define reservedptr(nombre) fp->GetVarOffset(v_reserved,nombre)
#define localptr(nombre) fp->GetVarOffset(v_local,nombre)
/* FIN DE VARINDEX */
#include <SDL/SDL.h>
/* Funciones de exportación de datos */
typedef int (TYPEOF_EDIV_Export)(char* cadena, int nparam, void* hfuncion);
typedef int (TYPEOF_EDIV_Export_Const)(char* cadena, int valor);
typedef int (TYPEOF_EDIV_Export_Global)(char* cadena, int valor);
typedef int (TYPEOF_EDIV_Export_Global_Tab)(char* cadena, int numregs);
typedef int (TYPEOF_EDIV_Export_Global_Struct)(char* cadena, int numregs);
typedef int (TYPEOF_EDIV_Export_Member_Int)(char* cadena, int valor);
typedef int (TYPEOF_EDIV_Export_Member_Str)(char* cadena, int tamano);
typedef int (TYPEOF_EDIV_Export_Member_Tab)(char* cadena, int numregs);
typedef int (TYPEOF_EDIV_Export_EndStruct)();
typedef int (TYPEOF_EDIV_Export_Local)(char* cadena, int valor);
typedef int (TYPEOF_EDIV_Export_Local_Tab)(char* cadena, int numregs);
typedef int (TYPEOF_EDIV_Export_Local_Struct)(char* cadena, int numregs);
typedef int (TYPEOF_EDIV_Export_Entrypoint)(int ep, void* hfuncion);
typedef int (TYPEOF_EDIV_Export_Priority)(int priority);
/* Call_Entrypoint */
typedef int (TYPEOF_Call_Entrypoint)(int ep, ...);
/* Dibuja */
typedef int (TYPEOF_Dibuja)(SDL_Surface *, SDL_Rect, SDL_Rect, int, int, int, int);
/* Errores */
typedef void (TYPEOF_Runtime_Error)(int, ...);
typedef void (TYPEOF_Critical_Error)(int, ...);
/* Obtiene offset de variable indexada dinámicamente */
typedef int (TYPEOF_GetVarOffset)(tipo_t tipo,char* nombre);
/* Finaliza el stub (exit) */
typedef void (TYPEOF_Stub_Quit)(int n);
/* EXPORTAFUNCS_PARAMS deben usarse como parámetros para ExportaFuncs */
#define EXPORTAFUNCS_PARAMS \
TYPEOF_EDIV_Export *EDIV_Export ,\
TYPEOF_EDIV_Export_Const *EDIV_Export_Const ,\
TYPEOF_EDIV_Export_Global *EDIV_Export_Global ,\
TYPEOF_EDIV_Export_Global_Tab *EDIV_Export_Global_Tab ,\
TYPEOF_EDIV_Export_Global_Struct *EDIV_Export_Global_Struct,\
TYPEOF_EDIV_Export_Member_Int *EDIV_Export_Member_Int ,\
TYPEOF_EDIV_Export_Member_Str *EDIV_Export_Member_Str ,\
TYPEOF_EDIV_Export_Member_Tab *EDIV_Export_Member_Tab ,\
TYPEOF_EDIV_Export_EndStruct *EDIV_Export_EndStruct ,\
TYPEOF_EDIV_Export_Local *EDIV_Export_Local ,\
TYPEOF_EDIV_Export_Local_Tab *EDIV_Export_Local_Tab ,\
TYPEOF_EDIV_Export_Local_Struct *EDIV_Export_Local_Struct ,\
TYPEOF_EDIV_Export_Entrypoint *EDIV_Export_Entrypoint ,\
TYPEOF_EDIV_Export_Priority *EDIV_Export_Priority
/*
* ENTRY-POINTS
*
* Estas funciones son llamadas por el STUB en determinados eventos
* (Cuando una DLL hace cierta acción, lo avisa al Stub y el stub se encarga de llamar
* a las correspondientes rutinas de las dll's, ordenadas por prioridad)
*/
// Constantes para EDIV_Export_Entrypoint
#define EDIV_set_video_mode 1 /* Al activar un nuevo modo de vídeo */
#define EDIV_process_palette 2 /* Al cargar una paleta */
#define EDIV_process_active_palette 3 /* Al modificar la paleta activa (usada en los fades) */
#define EDIV_process_sound 4 /* Al cargar un efecto sonoro */
#define EDIV_process_map 5 /* Al cargar un mapa */
#define EDIV_process_fpg 6 /* Al cargar un FPG */
#define EDIV_process_fnt 7 /* Al cargar una fuente */
#define EDIV_background_to_buffer 8 /* Volcar el fondo al buffer */
#define EDIV_buffer_to_video 9 /* Volcar el buffer a la memoria de video */
#define EDIV_post_process_scroll 10 /* Tras dibujar una ventana de scroll (sin los sprites) */
#define EDIV_post_process_m7 11 /* Tras dibujar una ventana de modo7 (sin los sprites) */
#define EDIV_post_process_m8 12 /* Tras dibujar una ventana de modo8 (sin los sprites) */
#define EDIV_post_process_buffer 13 /* Tras haber terminado de dibujarlo todo */
#define EDIV_post_process 14 /* Tras ejecutar el frame de un proceso (cualquier %) */
#define EDIV_put_sprite 15 /* Dibujar un sprite */
#define EDIV_ss_init 16 /* Inicio de salvapantallas */
#define EDIV_ss_frame 17 /* Frame de salvapantallas */
#define EDIV_ss_end 18 /* Fin de salvapantallas */
#define EDIV_frame 19 /* En cada frame */
#define EDIV_trace 20 /* Después de ejecutar cada instrucción de bytecode (solo en debug) */
#define EDIV_debug 21 /* Invocar al trazador - sentencia debug (solo en debug) */
#define EDIV_first_load 22 /* Se ejecuta al cargar la DLL en ejecucion */
#define EDIV_quit 23 /* Llamado por stub_quit() */
/* #defines para que la declaración de datos sea un poco más BASIC... :p */
#ifdef CONST
# undef CONST
#endif
#define FUNCTION EDIV_Export
#define CONST EDIV_Export_Const
#define GLOBAL EDIV_Export_Global
#define GLOBAL_ARRAY EDIV_Export_Global_Tab
#define GLOBAL_STRUCT EDIV_Export_Global_Struct
#define _INT EDIV_Export_Member_Int
#define _STRING EDIV_Export_Member_Str
#define _ARRAY EDIV_Export_Member_Tab
#define END_STRUCT EDIV_Export_EndStruct()
#define LOCAL EDIV_Export_Local
#define LOCAL_ARRAY EDIV_Export_Local_Tab
#define LOCAL_STRUCT EDIV_Export_Local_Struct
#define ENTRYPOINT(e) EDIV_Export_Entrypoint(EDIV_##e,e)
#define PRIORITY EDIV_Export_Priority
/*
* FUNCTION_PARAMS deben usarse como parametros para TODAS las funciones
* ¡ojo! debe ser igual en extern.h
*/
#define FUNCTION_PARAMS struct _fun_params *fp
struct _procs_s{
int id ; /* offset de los datos locales del proceso */
int tipo ; /* tipo de proceso */
int orden ; /* indice en proc_orden[] */
int num_params ; /* numero de parametros k coje ( NO SE PARA K SIRVE PERO PARA ALGO ESTARA CBP NO ? ) */
int imem ; /* Posicion en la k se quedo suspendido el proceso */
int priority ; /* Priority */
int frame; /* Frame completado */
int graph ;
};
struct _regions
{
int x , y , w , h ;
} ;
struct _existe {
int regions ;
int dibuja ;
} ;
struct _file
{
SDL_Surface *Surface ;
int existe ;
struct
{
int x , y ;
} cpoint[ 20 ] ;
} ;
struct _files
{
int num ;
int existe ;
struct _file *mapa ;
} ;
struct _fun_params{
int *pila ;
int *sp ;
int *mem ;
int num_params;
varindex_t *varindex ;
struct _procs_s *procs_s ;
int *num_procs ;
int *proc_orden ;
int *proceso_actual ;
unsigned char* nombre_program;
struct _regions *regions ;
struct _existe existe ;
struct _files *files ;
TYPEOF_Dibuja *Dibuja ;
TYPEOF_Call_Entrypoint *Call_Entrypoint ;
TYPEOF_Runtime_Error *Runtime_Error ;
TYPEOF_Critical_Error *Critical_Error ;
TYPEOF_GetVarOffset *GetVarOffset ;
TYPEOF_Stub_Quit *Stub_Quit ;
int imem_max;
SDL_Surface *screen;
} ;
/* Se usa igual que el getparm() de DIV */
#define getparm() fp->pila[(*fp->sp)--]
#define getstrparm() (char*)&fp->mem[fp->pila[(*fp->sp)--]]
/* Y esto por si los despistes xD */
#define retval(a) return (a)
/* Prototipos de los entrypoints */
void set_video_mode(void);
void process_palette(void);
void process_active_palette(void);
void process_sound(char *sound,int lenght);
void process_fpg(char *fpg,int fpg_lenght);
void process_map(char *map,int map_lenght);
void process_fnt(char *fnt,int fnt_lenght);
void background_to_buffer(void);
void buffer_to_video(void);
void post_process_scroll(void);
void post_process_m7(void);
void post_process_m8(void);
void post_process_buffer(void);
void post_process(void);
void put_sprite(unsigned char * si, int x,int y, int an, int al, int xg, int yg,
int ang, int size, int flags);
void ss_init(void);
void ss_frame(void);
void ss_end(void);
void frame(FUNCTION_PARAMS);
void trace(int imem, char* nombreprg, int* lin, void* dbg);
void debug(int imem, char* nombreprg, int* lin, void* dbg);
void first_load(FUNCTION_PARAMS) ;
void quit(void);
#ifdef __cplusplus
}
#endif
#endif /* __EDIV_EXPORT_H_ */

494
dlls/src/input/input.c Normal file
View file

@ -0,0 +1,494 @@
/*
* eDiv Compiler
* Copyleft (C) 2000-2002 Sion Entertainment
* http://www.sion-e.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <SDL/SDL.h>
#include <export.h>
#include "input.h"
#define _KEY(a) CONST(#a,a)
#define _esc 1
#define _f1 59
#define _f2 60
#define _f3 61
#define _f4 62
#define _f5 63
#define _f6 64
#define _f7 65
#define _f8 66
#define _f9 67
#define _f10 68
#define _f11 87
#define _f12 88
#define _prn_scr 55 /* Impr Pant */
#define _scroll_lock 70 /* Bloq Despl */
#define _wave 41 /* "º" */
#define _1 2
#define _2 3
#define _3 4
#define _4 5
#define _5 6
#define _6 7
#define _7 8
#define _8 9
#define _9 10
#define _0 11
#define _minus 12 /* ? */
#define _plus 13 /* ¿ */
#define _backspace 14
#define _tab 15
#define _q 16
#define _w 17
#define _e 18
#define _r 19
#define _t 20
#define _y 21
#define _u 22
#define _i 23
#define _o 24
#define _p 25
#define _l_brachet 26 /* "`" "^" */
#define _r_brachet 27 /* "+" "*" */
#define _enter 28
#define _caps_lock 58
#define _a 30
#define _s 31
#define _d 32
#define _f 33
#define _g 34
#define _h 35
#define _j 36
#define _k 37
#define _l 38
#define _semicolon 39 /* Ñ */
#define _apostrophe 40 /* { */
#define _backslash 43 /* } */
#define _l_shift 42
#define _z 44
#define _x 45
#define _c 46
#define _v 47
#define _b 48
#define _n 49
#define _m 50
#define _comma 51
#define _point 52
#define _slash 53 /* "-" "_" */
#define _r_shift 54
#define _control 29
#define _alt 56
#define _space 57
#define _ins 82
#define _home 71
#define _pgup 73
#define _del 83
#define _end 79
#define _pgdn 81
#define _up 72
#define _down 80
#define _left 75
#define _right 77
#define _num_lock 69
#define _c_backslash 90
#define _c_asterisk 91
#define _c_minus 92
#define _c_home 93
#define _c_up 94
#define _c_pgup 95
#define _c_left 96
#define _c_center 97
#define _c_right 98
#define _c_end 99
#define _c_down 100
#define _c_pgdn 101
#define _c_ins 102
#define _c_del 103
#define _c_plus 104
#define _c_enter 105
Uint8 *keys ;
Uint8 mbuttons;
int SDLtoDIV[1024] ;
int ExportaFuncs(EXPORTAFUNCS_PARAMS)
{
_KEY(_esc) ;
_KEY(_f1) ;
_KEY(_f2) ;
_KEY(_f3) ;
_KEY(_f4) ;
_KEY(_f5) ;
_KEY(_f6) ;
_KEY(_f7) ;
_KEY(_f8) ;
_KEY(_f9) ;
_KEY(_f10) ;
_KEY(_f11) ;
_KEY(_f12) ;
_KEY(_prn_scr ) ;
_KEY(_scroll_lock ) ;
_KEY(_wave) ;
_KEY(_1) ;
_KEY(_2) ;
_KEY(_3) ;
_KEY(_4) ;
_KEY(_5) ;
_KEY(_6) ;
_KEY(_7) ;
_KEY(_8) ;
_KEY(_9) ;
_KEY(_0) ;
_KEY(_minus) ;
_KEY(_plus) ;
_KEY(_backspace) ;
_KEY(_tab) ;
_KEY(_q) ;
_KEY(_w) ;
_KEY(_e) ;
_KEY(_r) ;
_KEY(_t) ;
_KEY(_y) ;
_KEY(_u) ;
_KEY(_i) ;
_KEY(_o) ;
_KEY(_p) ;
_KEY(_l_brachet) ;
_KEY(_r_brachet) ;
_KEY(_enter) ;
_KEY(_caps_lock ) ;
_KEY(_a) ;
_KEY(_s) ;
_KEY(_d) ;
_KEY(_f) ;
_KEY(_g) ;
_KEY(_h) ;
_KEY(_j) ;
_KEY(_k) ;
_KEY(_l) ;
_KEY(_semicolon) ;
_KEY(_apostrophe) ;
_KEY(_backslash) ;
_KEY(_l_shift) ;
_KEY(_z) ;
_KEY(_x) ;
_KEY(_c) ;
_KEY(_v) ;
_KEY(_b) ;
_KEY(_n) ;
_KEY(_m) ;
_KEY(_comma) ;
_KEY(_point) ;
_KEY(_slash) ;
_KEY(_r_shift) ;
_KEY(_control) ;
_KEY(_alt) ;
_KEY(_space) ;
_KEY(_ins) ;
_KEY(_home) ;
_KEY(_pgup) ;
_KEY(_del) ;
_KEY(_end) ;
_KEY(_pgdn) ;
_KEY(_up) ;
_KEY(_down) ;
_KEY(_left) ;
_KEY(_right) ;
_KEY(_num_lock) ;
_KEY(_c_backslash) ;
_KEY(_c_asterisk) ;
_KEY(_c_minus) ;
_KEY(_c_plus) ;
_KEY(_c_enter) ;
_KEY(_c_home) ;
_KEY(_c_pgup) ;
_KEY(_c_end) ;
_KEY(_c_pgdn) ;
_KEY(_c_up) ;
_KEY(_c_down) ;
_KEY(_c_left) ;
_KEY(_c_right) ;
_KEY(_c_center) ;
_KEY(_c_ins) ;
_KEY(_c_del) ;
FUNCTION("key",1,eDiv_Key) ;
GLOBAL_STRUCT("mouse",0);
_INT("x",0); /* Coordenada x */
_INT("y",0); /* Coordenada y */
_INT("graph",0); /* Gráfico */
_INT("file",0); /* FPG */
_INT("z",-512); /* Profundidad (TODO) */
_INT("angle",0); /* Ángulo (TODO) */
_INT("size",100); /* Tamaño (TODO) */
_INT("flags",0); /* Banderas (TODO) */
_INT("region",0); /* Región (TODO) */
_INT("left",0); /* Botón izquierdo */
_INT("middle",0); /* Botón central o de ruedecilla */
_INT("right",0); /* Botón derecho */
_INT("wheelup",0); /* Ruedecilla arriba (NUEVO) */
_INT("wheeldown",0); /* Ruedecilla abajo (NUEVO) */
_INT("cursor",0); /* Emulación con teclas de cursor (TODO) */
_INT("speed",0); /* Velocidad del ratón (TODO) */
_INT("transparency",0); /* Transparencia (NUEVO) (TODO) */
END_STRUCT;
ENTRYPOINT(first_load) ;
ENTRYPOINT(frame) ;
return TRUE;
}
int eDiv_Key(FUNCTION_PARAMS)
{
/* FILE *fichero ; */
int a ;
/* fichero = fopen("input.txt" , "a+" ) ; */
a = getparm() ;
/* fprintf( fichero , "key: %i , keys[30]: %i \n" , a , keys[30] ) ; */
/* fclose( fichero ) ; */
if ( a == _control )
if ( keys[ SDLK_RCTRL ] )
return 1 ;
if ( a == _alt )
if ( keys[ SDLK_RALT ] )
return 1 ;
return keys[ SDLtoDIV[a] ] ;
}
/*
* Entrypoints
*/
void first_load(FUNCTION_PARAMS)
{
int i ;
SDL_Init( SDL_INIT_EVENTTHREAD ) ;
for ( i = 0 ; i < 1024 ; i++ )
{
SDLtoDIV[ i ] = 0 ;
}
SDLtoDIV[ _esc ] = SDLK_ESCAPE ;
SDLtoDIV[ _1 ] = SDLK_1 ;
SDLtoDIV[ _2 ] = SDLK_2 ;
SDLtoDIV[ _3 ] = SDLK_3 ;
SDLtoDIV[ _4 ] = SDLK_4 ;
SDLtoDIV[ _5 ] = SDLK_5 ;
SDLtoDIV[ _6 ] = SDLK_6 ;
SDLtoDIV[ _7 ] = SDLK_7 ;
SDLtoDIV[ _8 ] = SDLK_8 ;
SDLtoDIV[ _9 ] = SDLK_9 ;
SDLtoDIV[ _0 ] = SDLK_0 ;
SDLtoDIV[ _minus ] = SDLK_MINUS ;
SDLtoDIV[ _plus ] =SDLK_EQUALS ;
SDLtoDIV[ _backspace ] =SDLK_BACKSPACE ;
SDLtoDIV[ _tab ] =SDLK_TAB ;
SDLtoDIV[ _p ] =SDLK_p ;
SDLtoDIV[ _w ] =SDLK_w ;
SDLtoDIV[ _e ] =SDLK_e ;
SDLtoDIV[ _r ] =SDLK_r ;
SDLtoDIV[ _t ] =SDLK_t ;
SDLtoDIV[ _y ] =SDLK_y ;
SDLtoDIV[ _u ] =SDLK_u ;
SDLtoDIV[ _i ] =SDLK_i ;
SDLtoDIV[ _o ] =SDLK_o ;
SDLtoDIV[ _p ] =SDLK_p ;
SDLtoDIV[ _l_brachet ] =SDLK_LEFTBRACKET ;
SDLtoDIV[ _r_brachet ] =SDLK_RIGHTBRACKET ;
SDLtoDIV[ _enter ] =SDLK_RETURN ;
SDLtoDIV[ _control ] =SDLK_LCTRL ;
SDLtoDIV[ _a ] =SDLK_a ;
SDLtoDIV[ _s ] =SDLK_s ;
SDLtoDIV[ _d ] =SDLK_d ;
SDLtoDIV[ _f ] =SDLK_f ;
SDLtoDIV[ _g ] =SDLK_g ;
SDLtoDIV[ _h ] =SDLK_h ;
SDLtoDIV[ _j ] =SDLK_j ;
SDLtoDIV[ _k ] =SDLK_k ;
SDLtoDIV[ _l ] =SDLK_l ;
SDLtoDIV[ _semicolon ] =SDLK_SEMICOLON ;
SDLtoDIV[ _apostrophe ] =SDLK_QUOTE ;
SDLtoDIV[ _wave ] =SDLK_BACKQUOTE ;
SDLtoDIV[ _l_shift ] =SDLK_LSHIFT ;
SDLtoDIV[ _backslash ] =SDLK_BACKSLASH ;
SDLtoDIV[ _z ] =SDLK_z ;
SDLtoDIV[ _x ] =SDLK_x ;
SDLtoDIV[ _c ] =SDLK_c ;
SDLtoDIV[ _v ] =SDLK_v ;
SDLtoDIV[ _b ] =SDLK_b ;
SDLtoDIV[ _n ] =SDLK_n ;
SDLtoDIV[ _m ] =SDLK_m ;
SDLtoDIV[ _comma ] =SDLK_COMMA ;
SDLtoDIV[ _point ] =SDLK_PERIOD ;
SDLtoDIV[ _slash ] =SDLK_SLASH ;
SDLtoDIV[ _r_shift ] =SDLK_RSHIFT ;
SDLtoDIV[ _prn_scr ] =SDLK_SYSREQ ;
SDLtoDIV[ _alt ] =SDLK_LALT ;
SDLtoDIV[ _space ] =SDLK_SPACE ;
SDLtoDIV[ _caps_lock ] =SDLK_CAPSLOCK ;
SDLtoDIV[ _f1 ] =SDLK_F1 ;
SDLtoDIV[ _f2 ] =SDLK_F2 ;
SDLtoDIV[ _f3 ] =SDLK_F3 ;
SDLtoDIV[ _f4 ] =SDLK_F4 ;
SDLtoDIV[ _f5 ] =SDLK_F5 ;
SDLtoDIV[ _f6 ] =SDLK_F6 ;
SDLtoDIV[ _f7 ] =SDLK_F7 ;
SDLtoDIV[ _f8 ] =SDLK_F8 ;
SDLtoDIV[ _f9 ] =SDLK_F9 ;
SDLtoDIV[ _f10 ] =SDLK_F10 ;
SDLtoDIV[ _f11 ] =SDLK_F11 ;
SDLtoDIV[ _f12 ] =SDLK_F12 ;
SDLtoDIV[ _num_lock ] =SDLK_NUMLOCK ;
SDLtoDIV[ _scroll_lock ] =SDLK_SCROLLOCK ;
SDLtoDIV[ _home ] =SDLK_HOME ;
SDLtoDIV[ _up ] =SDLK_UP ;
SDLtoDIV[ _pgup ] =SDLK_PAGEUP ;
SDLtoDIV[ _end ] =SDLK_END ;
SDLtoDIV[ _down ] =SDLK_DOWN ;
SDLtoDIV[ _left ] =SDLK_LEFT ;
SDLtoDIV[ _right ] =SDLK_RIGHT ;
SDLtoDIV[ _pgdn ] =SDLK_PAGEDOWN ;
SDLtoDIV[ _ins ] =SDLK_INSERT ;
SDLtoDIV[ _c_del ] =SDLK_KP_PERIOD ;
SDLtoDIV[ _c_backslash ] =SDLK_KP_DIVIDE ;
SDLtoDIV[ _c_asterisk ] =SDLK_KP_MULTIPLY ;
SDLtoDIV[ _c_minus ] =SDLK_KP_MINUS ;
SDLtoDIV[ _c_plus ] =SDLK_KP_PLUS ;
SDLtoDIV[ _c_enter ] =SDLK_KP_ENTER ;
SDLtoDIV[ _c_ins ] =SDLK_KP0 ;
SDLtoDIV[ _c_end ] =SDLK_KP1 ;
SDLtoDIV[ _c_down ] =SDLK_KP2 ;
SDLtoDIV[ _c_pgdn ] =SDLK_KP3 ;
SDLtoDIV[ _c_left ] =SDLK_KP4 ;
SDLtoDIV[ _c_center ] =SDLK_KP5 ;
SDLtoDIV[ _c_right ] =SDLK_KP6 ;
SDLtoDIV[ _c_home ] =SDLK_KP7 ;
SDLtoDIV[ _c_up ] =SDLK_KP8 ;
SDLtoDIV[ _c_pgup ] =SDLK_KP9 ;
}
void frame(FUNCTION_PARAMS)
{
int numkeys ;
int _mouse=globalptr("mouse");
SDL_Rect srcrect,dstrect;
SDL_Surface* mapamouse;
SDL_PumpEvents();
keys = SDL_GetKeyState(&numkeys ) ;
/* MOUSE */
mbuttons = SDL_GetMouseState(&fp->mem[_mouse],&fp->mem[_mouse+1]);
/* Ponemos los 5 botones a 0 */
memset(&fp->mem[_mouse+9],0,5*4);
if(mbuttons&SDL_BUTTON(1))
fp->mem[_mouse+9]=1;
if(mbuttons&SDL_BUTTON(2))
fp->mem[_mouse+10]=1;
if(mbuttons&SDL_BUTTON(3))
fp->mem[_mouse+11]=1;
if(mbuttons&SDL_BUTTON(4)) /* podria no funcionar ¿necesario sdl_event? */
fp->mem[_mouse+12]=1;
if(mbuttons&SDL_BUTTON(5)) /* podria no funcionar ¿necesario sdl_event? */
fp->mem[_mouse+13]=1;
/* si mouse.graph!=0 */
if(fp->mem[_mouse+2]!=0) {
mapamouse=fp->files[fp->mem[_mouse+3]].mapa[fp->mem[_mouse+2]].Surface;
srcrect.x=0;
srcrect.y=0;
srcrect.w=mapamouse->w;
srcrect.h=mapamouse->h;
dstrect.x=fp->mem[_mouse]-fp->files[fp->mem[_mouse+3]].mapa[fp->mem[_mouse+2]].cpoint[0].x;
dstrect.y=fp->mem[_mouse+1]-fp->files[fp->mem[_mouse+3]].mapa[fp->mem[_mouse+2]].cpoint[0].y;
dstrect.w=mapamouse->w;
dstrect.h=mapamouse->h;
/*
* TODO: añadir chequeo de error si no existe file o mapa
*/
fp->Dibuja(mapamouse,srcrect,dstrect,fp->mem[_mouse+4],255,0,0);
}
/* FIN DE MOUSE */
/* FILE* fichero ; */
/* fichero = fopen( "input.txt" , "w+" ) ; */
/* for ( i = 0 ; i < 256 ; i++ ) */
/* keys[i] = 0 ; */
/*
for ( i = 0 ; i < 256 ; i++ )
{
if ( event[i].type == SDL_KEYDOWN )
{
keys[ SDLtoDIV[ event[i].key.keysym.sym ] ] = 1 ;
}
if ( event[i].type == SDL_KEYUP )
{
keys[ SDLtoDIV[ event[i].key.keysym.sym ] ] = 0 ;
}
}*/
/*
while(SDL_PollEvent(&tecla))
{
if(tecla.type == SDL_KEYDOWN)
{
if (
keys[tecla.key.keysym.sym] = 1 ;
//i=(int)tecla.key.keysym.sym;
}
}
*/
/* for ( i = 0 ; i < 256 ; i++ )
{
fprintf( fichero , "%i " , keys[i] ) ;
}
fprintf( fichero , "\n" ) ;
*/
//fclose( fichero ) ;
}

3
dlls/src/input/input.def Normal file
View file

@ -0,0 +1,3 @@
LIBRARY input
EXPORTS
ExportaFuncs

6
dlls/src/input/input.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef __EDIV_INPUT_H_
#define __EDIV_INPUT_H_
int eDiv_Key(FUNCTION_PARAMS) ;
#endif __EDIV_INPUT_H_

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "input", "input.vcproj", "{92E50294-4312-49E4-848B-5C9FF43AB27D}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{92E50294-4312-49E4-848B-5C9FF43AB27D}.Debug.ActiveCfg = Debug|Win32
{92E50294-4312-49E4-848B-5C9FF43AB27D}.Debug.Build.0 = Debug|Win32
{92E50294-4312-49E4-848B-5C9FF43AB27D}.Release.ActiveCfg = Release|Win32
{92E50294-4312-49E4-848B-5C9FF43AB27D}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,138 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="input"
ProjectGUID="{92E50294-4312-49E4-848B-5C9FF43AB27D}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;INPUT_EXPORTS"
MinimalRebuild="TRUE"
ExceptionHandling="FALSE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sdlmain.lib sdl.lib"
OutputFile="$(OutDir)/input.dll"
LinkIncremental="2"
ModuleDefinitionFile="../input.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/input.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/input.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;INPUT_EXPORTS"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sdlmain.lib sdl.lib"
OutputFile="$(OutDir)/input.dll"
LinkIncremental="1"
ModuleDefinitionFile="../input.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/input.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="codigo"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\input.c">
</File>
</Filter>
<Filter
Name="cabeceras"
Filter="h;hpp;hxx;hm;inl;inc">
<File
RelativePath="..\input.h">
</File>
</Filter>
<Filter
Name="definiciones"
Filter="def;">
<File
RelativePath="..\input.def">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

400
dlls/src/math/math.c Normal file
View file

@ -0,0 +1,400 @@
/*
* eDiv Compiler
* Copyleft (C) 2000-2002 Sion Entertainment
* http://www.sion-e.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* EDIVSTD.DLL
* Esta librería contiene los datos más básicos que puede requerir un programa
* DIV, tal como las opciones de compilación, estructura reserved, etc.
*/
#include <stdio.h>
#include <time.h>
#include <export.h>
#include "math.h"
int seno[90001] ;
int ExportaFuncs(EXPORTAFUNCS_PARAMS)
{
CONST("pi",180000);
FUNCTION("abs",1,eDiv_Abs);
FUNCTION("pow",2,eDiv_Pow);
FUNCTION("sqrt",1,eDiv_Sqrt);
FUNCTION("rand",2,eDiv_Rand);
FUNCTION("rand_seed",1,eDiv_RandSeed) ;
FUNCTION("sin",1,eDiv_Sin) ;
FUNCTION("cos",1,eDiv_Cos) ;
FUNCTION("tan",1,eDiv_Tan) ;
FUNCTION("get_angle",1,eDiv_GetAngle) ;
FUNCTION("get_dist",1,eDiv_GetDist) ;
FUNCTION("get_distx",2,eDiv_GetDistX) ;
FUNCTION("get_disty",2,eDiv_GetDistY) ;
FUNCTION("fget_angle",4,eDiv_FgetAngle) ;
FUNCTION("fget_dist",4,eDiv_FgetDist) ;
FUNCTION("near_angle",3,eDiv_NearAngle) ;
FUNCTION("cpysign",2,eDiv_cpysign) ;
FUNCTION("max",2,eDiv_max) ;
FUNCTION("min",2,eDiv_min) ;
FUNCTION("xmax",3,eDiv_xmax) ;
FUNCTION("xmin",3,eDiv_xmin) ;
FUNCTION("xmid",3,eDiv_xmid) ;
ENTRYPOINT(first_load) ;
return TRUE;
}
int eDiv_Abs(FUNCTION_PARAMS)
{
int a = getparm() ;
if ( a < 0 ) a = -a ;
return a ;
}
int eDiv_Pow(FUNCTION_PARAMS)
{
int a,b,c,n,i ;
b = getparm() ;
a = getparm() ;
n = 1 ;
c = b ;
if ( c < 0 ) c = -c ;
for ( i = 1 ; i < c ; i++ )
{
n *= a ;
}
if ( b < 0 )
n = 1 / n ;
return n ;
}
int eDiv_Sqrt(FUNCTION_PARAMS)
{
int a ;
a = getparm() ;
return sqrt( a ) ;
}
int eDiv_Rand(FUNCTION_PARAMS)
{
int a,b,n ;
b = getparm() ;
a = getparm() ;
n = (int)(rand()%(b-a+1))+a ;
return n ;
}
int eDiv_RandSeed(FUNCTION_PARAMS)
{
int a ;
a = getparm() ;
if ( a == 0 )
srand(time(NULL)) ;
else
srand(a) ;
return 1 ;
}
int eDiv_Sin(FUNCTION_PARAMS)
{
int a ;
a = getparm() ;
a = prepara_angulo(a) ;
if ( a <= 90000 )
return seno[a];
if ( a <= 180000 )
return seno[180000-a] ;
if ( a <= 270000 )
return -seno[a-180000] ;
return -seno[360000-a] ;
}
int eDiv_Cos(FUNCTION_PARAMS)
{
int a ;
a = getparm() ;
a = prepara_angulo(a) ;
if ( a <= 90000 )
return seno[90000-a];
if ( a <= 180000 )
return -seno[a-90000] ;
if ( a <= 270000 )
return -seno[270000-a] ;
return seno[a-270000] ;
}
int eDiv_Tan(FUNCTION_PARAMS)
{
int a , b , c;
a = getparm() ;
a = prepara_angulo(a) ;
if ( a <= 90000 )
b = seno[a];
else
if ( a <= 180000 )
b = seno[180000-a] ;
else
if ( a <= 270000 )
b = -seno[a-180000] ;
else
b = -seno[360000-a] ;
if ( a <= 90000 )
c = seno[90000-a];
else
if ( a <= 180000 )
c = -seno[a-90000] ;
else
if ( a <= 270000 )
c = -seno[270000-a] ;
else
c = seno[a-270000] ;
if ( c == 0 )
return 0x7FFFFFFF ;
else
return ( (int)(b/c) ) ;
return 0 ;
}
int eDiv_GetAngle(FUNCTION_PARAMS)
{
int id1 , id2 ;
int x1 , x2 , y1, y2 ;
int a = getparm() ;
id1 = fp->procs_s[ fp->proc_orden[ *fp->proceso_actual ] ].id ;
id2 = a ;
x1 = local("x",id1) ;
y1 = local("y",id1) ;
x2 = local("x",id2) ;
y2 = local("y",id2) ;
if ( (x2-x1) != 0 )
{
a = atan( (double)((y2-y1) / (x2-x1)) ) / PIOVER180 ;
if ( x2 < x1 )
a+= 180 ;
}else
if ( y2 > y1 )
a = 90 ;
else
a = 270 ;
a *= 1000 ;
a = prepara_angulo(a) ;
return a ;
}
int eDiv_GetDist(FUNCTION_PARAMS)
{
int id1 , id2 ;
int x1 , x2 , y1, y2 ;
int a = getparm() ;
id1 = fp->procs_s[ fp->proc_orden[*fp->proceso_actual] ].id ;
id2 = a ;
x1 = local("x",id1) ;
y1 = local("y",id1) ;
x2 = local("x",id2) ;
y2 = local("y",id2) ;
a = sqrt( pow( x2-x1 , 2 ) + pow( y2-y1 , 2 ) ) ;
return a ;
}
int eDiv_GetDistX(FUNCTION_PARAMS)
{
int a , b ;
b = getparm() ; /* distancia */
a = getparm() ; /* angulo */
a = (int) b* cos( (a/1000)*PIOVER180 ) ;
return a ;
}
int eDiv_GetDistY(FUNCTION_PARAMS)
{
int a , b ;
b = getparm() ; /* distancia */
a = getparm() ; /* angulo */
a = (int) b* sin( (a/1000)*PIOVER180 ) ;
return a ;
}
int eDiv_FgetAngle(FUNCTION_PARAMS)
{
int x1 , y1 , x2 , y2 , a ;
y2 = getparm() ;
x2 = getparm() ;
y1 = getparm() ;
x1 = getparm() ;
if ( (x2-x1) != 0 )
{
a = atan( (double)((y2-y1) / (x2-x1)) ) / PIOVER180 ;
if ( x2 < x1 )
a+= 180 ;
}else
if ( y2 > y1 )
a = 90 ;
else
a = 270 ;
a *= 1000 ;
a = prepara_angulo(a) ;
return a ;
}
int eDiv_FgetDist(FUNCTION_PARAMS)
{
int x1 , y1 , x2 , y2 , a;
y2 = getparm() ;
x2 = getparm() ;
y1 = getparm() ;
x1 = getparm() ;
a = sqrt( pow( x2-x1 , 2 ) + pow( y2-y1 , 2 ) ) ;
return a ;
}
int eDiv_NearAngle(FUNCTION_PARAMS)
{
int a , b , c ;
c = getparm() ;
b = getparm() ;
a = getparm() ;
a = prepara_angulo(a) ;
b = prepara_angulo(b) ;
c = prepara_angulo(c) ;
if ( abs(a - b) <= c )
return b ;
if ( a < b )
{
if ( abs( b-a ) < 180000 )
{
a = prepara_angulo( a+c ) ;
}else
{
a = prepara_angulo( a-c ) ;
}
return a ;
}else
{
if ( abs( b-a ) < 180000 )
{
a = prepara_angulo( a-c ) ;
}else
{
a = prepara_angulo( a+c ) ;
}
return a ;
}
return 0 ;
}
int eDiv_cpysign(FUNCTION_PARAMS)
{
int s = getparm() ;
int n = getparm() ;
return ((s<0)?((n<0)?(n):(-n)):((n>=0)?(n):(-n)));
}
int eDiv_max(FUNCTION_PARAMS)
{
int n2 = getparm() ;
int n1 = getparm() ;
return ((n1>n2)?(n1):(n2));
}
int eDiv_min(FUNCTION_PARAMS)
{
int n2 = getparm() ;
int n1 = getparm() ;
return ((n1<n2)?(n1):(n2));
}
int eDiv_xmax(FUNCTION_PARAMS)
{
int n3 = getparm() ;
int n2 = getparm() ;
int n1 = getparm() ;
int m=n1;
if(n2>m) m=n2;
if(n3>m) m=n3;
return m;
}
int eDiv_xmin(FUNCTION_PARAMS)
{
int n3 = getparm() ;
int n2 = getparm() ;
int n1 = getparm() ;
int m=n1;
if(n2<m) m=n2;
if(n3<m) m=n3;
return m;
}
int eDiv_xmid(float n1,float n2,float n3){
if((n1<n2 && n1<n3 && n2<n3) ||
(n1>n2 && n1>n3 && n2>=n3) ||
(n1>n2 && n1==n3 && n2<n3))
return n2;
if((n1<n2 && n1<n3 && n2>n3) ||
(n1>n2 && n1>n3 && n2<n3) ||
(n1==n2 && n1>n3 && n2>n3))
return n3;
return n1;
}
/*
* Entrypoints
*/
void first_load()
{
int i ;
/* Calculamos los senos del 0 al 90000C */
for ( i = 0 ; i < 90000 ; i++ )
{
seno[i] = ftomil( sin( (i / 1000)*PIOVER180 ) );
}
seno[90000]=1000;
srand(time(NULL));
}
/*
* Funciones internas de la DLL
*/
int ftomil( float n )
{
return ((int)(n*1000)) ;
}
int prepara_angulo( int n )
{
n = n % 360000 ;
if ( n < 0 ) n = n + 360000 ;
return n ;
}

3
dlls/src/math/math.def Normal file
View file

@ -0,0 +1,3 @@
LIBRARY math
EXPORTS
ExportaFuncs

33
dlls/src/math/math.h Normal file
View file

@ -0,0 +1,33 @@
#ifndef __EDIV_MATH_H
#define __EDIV_MATH_H
#define PIOVER180 0.017453292519943295769236907684886
int eDiv_Abs(FUNCTION_PARAMS) ;
int eDiv_Pow(FUNCTION_PARAMS) ;
int eDiv_Sqrt(FUNCTION_PARAMS) ;
int eDiv_Rand(FUNCTION_PARAMS) ;
int eDiv_RandSeed(FUNCTION_PARAMS) ;
int eDiv_Sin(FUNCTION_PARAMS) ;
int eDiv_Cos(FUNCTION_PARAMS) ;
int eDiv_Tan(FUNCTION_PARAMS) ;
int eDiv_GetAngle(FUNCTION_PARAMS) ;
int eDiv_GetDist(FUNCTION_PARAMS) ;
int eDiv_GetDistX(FUNCTION_PARAMS) ;
int eDiv_GetDistY(FUNCTION_PARAMS) ;
int eDiv_FgetAngle(FUNCTION_PARAMS) ;
int eDiv_FgetDist(FUNCTION_PARAMS) ;
int eDiv_NearAngle(FUNCTION_PARAMS) ;
float eDiv_cpysign(float n,float s);
float eDiv_max(float n1,float n2);
float eDiv_min(float n1,float n2);
float eDiv_xmax(float n1,float n2,float n3);
float eDiv_xmin(float n1,float n2,float n3);
float eDiv_xmid(float n1,float n2,float n3);
int ftomil(float) ;
int prepara_angulo( int ) ;
#endif

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "math", "math.vcproj", "{56A4746D-5A73-4CA5-BD0C-959F14B503E7}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{56A4746D-5A73-4CA5-BD0C-959F14B503E7}.Debug.ActiveCfg = Debug|Win32
{56A4746D-5A73-4CA5-BD0C-959F14B503E7}.Debug.Build.0 = Debug|Win32
{56A4746D-5A73-4CA5-BD0C-959F14B503E7}.Release.ActiveCfg = Release|Win32
{56A4746D-5A73-4CA5-BD0C-959F14B503E7}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="math"
ProjectGUID="{56A4746D-5A73-4CA5-BD0C-959F14B503E7}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MATH_EXPORTS"
MinimalRebuild="TRUE"
ExceptionHandling="FALSE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/math.dll"
LinkIncremental="2"
ModuleDefinitionFile="../math.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/math.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/math.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MATH_EXPORTS"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/math.dll"
LinkIncremental="1"
ModuleDefinitionFile="../math.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/math.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="codigo"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\math.c">
</File>
</Filter>
<Filter
Name="cabeceras"
Filter="h;hpp;hxx;hm;inl;inc">
<File
RelativePath="..\math.h">
</File>
</Filter>
<Filter
Name="definiciones"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="..\math.def">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

115
dlls/src/scroll/scroll.c Normal file
View file

@ -0,0 +1,115 @@
#include <SDL/SDL.h>
#include <export.h>
//#include "../../shared/varindex.h"
#include "scroll.h"
struct
{
int existe ;
int file, graph ;
int x0 , y0 , x1 , y1 ;
int z ;
int camera ;
int ratio ;
int speed ;
int region1 , region2 ;
}scrolls[10] ;
int ExportaFuncs(EXPORTAFUNCS_PARAMS)
{
GLOBAL_STRUCT("scroll",9);
_INT("x0",0);
_INT("y0",0);
_INT("x1",0);
_INT("y1",0);
_INT("z",0);
_INT("camera",0);
_INT("ratio",0);
_INT("speed",0);
_INT("region1",0);
_INT("region2",0);
END_STRUCT;
FUNCTION("start_scroll",6,eDiv_StartScroll) ;
ENTRYPOINT( frame ) ;
return TRUE ;
}
FILE * fichero ;
int eDiv_StartScroll(FUNCTION_PARAMS)
{
int num , f , g1 , g2 , r , b ;
b = getparm() ;
r = getparm() ;
g2 = getparm() ;
g1 = getparm() ;
f = getparm() ;
num = getparm() ;
if ( scrolls[num].existe )
return -1 ;
scrolls[num].existe = 1 ;
/*
fichero = fopen("scroll.txt" , "w+" ) ;
fprintf(fichero , "glo_scroll: %d" , varindex[_glo_scroll] ) ;
fclose(fichero) ;*/
/*
fp->mem[ varindex[_glo_scroll] + 0 ] = 0 ;
fp->mem[ varindex[_glo_scroll] + 1 ] = 0 ;
fp->mem[ varindex[_glo_scroll] + 2 ] = 0 ;
fp->mem[ varindex[_glo_scroll] + 3 ] = 0 ;
fp->mem[ varindex[_glo_scroll] + 4 ] = 512 ;
fp->mem[ varindex[_glo_scroll] + 0 ] = 0 ;
fp->mem[ varindex[_glo_scroll] + 0 ] = b ;
fp->mem[ varindex[_glo_scroll] + 0 ] = 0 ;
fp->mem[ varindex[_glo_scroll] + 0 ] = r ;
fp->mem[ varindex[_glo_scroll] + 0 ] = r ;
*/
return 1 ;
}
//============== Entrypoints =====================================================
void frame(FUNCTION_PARAMS)
{
/*
* de momento solo hay esta demostracion de que fp->Dibuja funciona xDD
* falta hacer los scrolls :P
*/
/*
SDL_Rect srcrect, dstrect ;
if ( fp->existe.dibuja )
{
if ( fp->files[0].existe )
{
if ( fp->files[0].mapa[1000].existe )
{
srcrect.x = 0 ;
srcrect.y = 0 ;
srcrect.w = fp->files[0].mapa[1000].Surface->w ;
srcrect.h = fp->files[0].mapa[1000].Surface->h ;
fp->Dibuja( fp->files[0].mapa[1000].Surface , srcrect , srcrect , 0 , 128 ) ;
}
}
}
*/
}

View file

@ -0,0 +1,3 @@
LIBRARY scroll
EXPORTS
ExportaFuncs

3
dlls/src/scroll/scroll.h Normal file
View file

@ -0,0 +1,3 @@
int eDiv_StartScroll(FUNCTION_PARAMS) ;

95
dlls/src/strings/conv.c Normal file
View file

@ -0,0 +1,95 @@
#include <memory.h>
#include "conv.h"
/* Tabla de conversión de caracteres MS-DOS a Windows */
int dos_chars=0;
byte dos_to_win[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197,
201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 248, 163, 216, 215, 131,
225, 237, 243, 250, 241, 209, 170, 186, 191, 174, 172, 189, 188, 161, 171, 187,
166, 166, 166, 166, 166, 193, 194, 192, 169, 166, 166, 43, 43, 162, 165, 43,
43, 45, 45, 43, 45, 43, 227, 195, 43, 43, 45, 45, 166, 45, 43, 164,
240, 208, 202, 203, 200, 105, 205, 206, 207, 43, 43, 166, 95, 166, 204, 175,
211, 223, 212, 210, 245, 213, 181, 254, 222, 218, 219, 217, 253, 221, 175, 180,
173, 177, 61, 190, 182, 167, 247, 184, 176, 168, 183, 185, 179, 178, 166, 160
};
/* Tabla de conversión de caracteres Windows a MS-DOS */
byte win_to_dos[256] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 159, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
255, 173, 189, 156, 207, 190, 254, 245, 249, 184, 166, 174, 170, 240, 169, 238,
248, 241, 253, 252, 239, 230, 244, 250, 247, 251, 167, 175, 172, 171, 243, 168,
183, 181, 182, 199, 142, 143, 146, 128, 212, 144, 210, 211, 222, 214, 215, 216,
209, 165, 227, 224, 226, 229, 153, 158, 157, 235, 233, 234, 154, 237, 232, 225,
133, 160, 131, 198, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161, 140, 139,
208, 164, 149, 162, 147, 228, 148, 246, 155, 151, 163, 150, 129, 236, 231, 152
};
byte lower[256];
byte upper[256];
byte c_convert (byte c)
{
return dos_chars ? c : win_to_dos[c];
}
void set_c_lower (const byte * from, const byte * to)
{
if (dos_chars)
while (*from) lower[win_to_dos[*from++]] = win_to_dos[*to++] ;
else
while (*from) lower[*from++] = *to++ ;
}
void set_c_upper (const byte * from, const byte * to)
{
if (dos_chars)
while (*from) upper[win_to_dos[*from++]] = win_to_dos[*to++] ;
else
while (*from) upper[*from++] = *to++ ;
}
void inicializa_lower()
{
memset (lower, 0, 256);
set_c_lower ("ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz");
set_c_lower ("abcdefghijklmnopqrstuvwxyz","abcdefghijklmnopqrstuvwxyz");
set_c_lower ("ÁÉÍÓÚÑÇÀÈÌÒÙÄËÏÖÜÝÂÊÎÔÛÆÃÅÕ","áéíóúñçàèìòùäëïöüýâêîôûæãåõ");
set_c_lower("áéíóúñçàèìòùäëïöüýâêîôûæãåõ","áéíóúñçàèìòùäëïöüýâêîôûæãåõ");
set_c_lower("1234567890#$_ºª","1234567890#$_ºª");
}
void inicializa_upper()
{
memset (upper, 0, 256);
set_c_upper ("abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ");
set_c_upper ("ABCDEFGHIJKLMNOPQRSTUVWXYZ","ABCDEFGHIJKLMNOPQRSTUVWXYZ");
set_c_upper ("áéíóúñçàèìòùäëïöüýâêîôûæãåõ","ÁÉÍÓÚÑÇÀÈÌÒÙÄËÏÖÜÝÂÊÎÔÛÆÃÅÕ");
set_c_upper("ÁÉÍÓÚÑÇÀÈÌÒÙÄËÏÖÜÝÂÊÎÔÛÆÃÅÕ","ÁÉÍÓÚÑÇÀÈÌÒÙÄËÏÖÜÝÂÊÎÔÛÆÃÅÕ");
set_c_upper("1234567890#$_ºª","1234567890#$_ºª");
}

22
dlls/src/strings/conv.h Normal file
View file

@ -0,0 +1,22 @@
#ifndef __EDIV_CONV_H_
#define __EDIV_CONV_H_
#ifndef byte
#define byte unsigned char
#endif
byte dos_to_win[256];
byte win_to_dos[256];
byte lower[256];
byte upper[256];
byte c_convert(byte c);
void set_c_lower (const byte *from, const byte *to);
void inicializa_lower();
void set_c_upper (const byte *from, const byte *to);
void inicializa_upper();
#endif __CONV_H_

242
dlls/src/strings/strings.c Normal file
View file

@ -0,0 +1,242 @@
#include <stdio.h>
#include <ctype.h>
#include <export.h>
#include "conv.h"
/************************/
/* char() * */
/* lower() * HECHA */
/* strcat() * HECHA */
/* strchr() * HECHA */
/* strcmp() * HECHA */
/* strcpy() * HECHA */
/* strdel() * */
/* strlen() * HECHA */
/* strset() * HECHA */
/* strstr() * HECHA */
/* upper() * HECHA */
/* calculate() * HECHA */
/* fcalculate() * HECHA */
/* itoa() * */
/* asc() * */ /* [<CicTec> text=ASC(65); // test="A";] (Una peticion suya :). */
/* ftoa() * */ /* Para los nuevos FLOAT :) */
/************************/
/* Rutinas eDiv! :) */
char *DIV_strcpy(FUNCTION_PARAMS);
size_t DIV_strlen(FUNCTION_PARAMS);
int DIV_strcmp(FUNCTION_PARAMS);
char *DIV_strchr(FUNCTION_PARAMS);
char *DIV_strcat(FUNCTION_PARAMS);
char *DIV_strstr(FUNCTION_PARAMS);
int DIV_atoi(FUNCTION_PARAMS);
float DIV_atof(FUNCTION_PARAMS);
char *DIV_lower(FUNCTION_PARAMS);
char *DIV_upper(FUNCTION_PARAMS);
char *DIV_strset(FUNCTION_PARAMS);
char *DIV_itoa(FUNCTION_PARAMS);
/* Rutinas internas */
static int hexval(char c);
/* Variables */
byte i_lower=0; /* lower ya esta inicializado? */
byte i_upper=0; /* upper ya esta inicializado? */
int ExportaFuncs(EXPORTAFUNCS_PARAMS)
{
FUNCTION("strcpy",2,DIV_strcpy);
FUNCTION("strlen",1,DIV_strlen);
FUNCTION("strcmp",2,DIV_strcmp);
FUNCTION("strchr",2,DIV_strchr);
FUNCTION("strcat",2,DIV_strcat);
FUNCTION("strstr",2,DIV_strstr);
FUNCTION("strset",2,DIV_strset);
/* Estas dos son iguales, lo sengundo es por una standarizacion :) */
FUNCTION("calculate",1,DIV_atoi);
FUNCTION("atoi",1,DIV_atoi);
/* Idem a lo anterior, pero para los datos float :) */
FUNCTION("fcalculate",1,DIV_atof);
FUNCTION("atof",1,DIV_atof);
FUNCTION("lower",1,DIV_lower);
FUNCTION("upper",1,DIV_upper);
return TRUE;
}
char *DIV_strcpy(FUNCTION_PARAMS)
{
char *src=(char *)getparm();
char *dest=(char *)getparm();
char *tmp = dest;
while ((*dest++ = *src++) != '\0');
return tmp;
}
size_t DIV_strlen(FUNCTION_PARAMS)
{
char *s = (char *)getparm();
const char *sc;
for(sc = s; *sc != '\0'; ++sc);
return sc - s;
}
char *DIV_strset(FUNCTION_PARAMS)
{
int valor=getparm();
char *cadena=(char *)getparm();
char *inicio=cadena;
while (*cadena)
*cadena++ = (char)valor;
return inicio;
}
int DIV_strcmp(FUNCTION_PARAMS)
{
const char *ct = (const char *)getparm();
const char *cs = (const char *)getparm();
signed char __res;
while (1) {
if ((__res = *cs - *ct++) != 0 || !*cs++)
break;
}
return __res;
}
char *DIV_strchr(FUNCTION_PARAMS)
{
int c = getparm();
const char *s = (const char *)getparm();
for(; *s != (char) c; ++s)
if (*s == '\0')
return NULL;
return (char *) s;
}
char *DIV_strcat(FUNCTION_PARAMS)
{
const char *src = (const char *)getparm();
char *dest = (char *)getparm();
char *tmp = dest;
while(*dest)
dest++;
while((*dest++ = *src++) != '\0')
;
return tmp;
}
char *DIV_strstr(FUNCTION_PARAMS)
{
const char *s2 = (const char*)getparm();
const char *s1 = (const char*)getparm();
int l1, l2;
l2 = strlen(s2);
if (!l2)
return (char *)s1;
l1 = strlen(s1);
while(l1 >= l2) {
l1--;
if (!memcmp(s1,s2,l2))
return (char *)s1;
s1++;
}
return NULL;
}
int DIV_atoi(FUNCTION_PARAMS)
{
const char *num = (const char*)getparm();
int value = 0;
if (num[0] == '0' && num[1] == 'x') {
/* hexadecimal */
num += 2;
while (*num && isxdigit(*num))
value = value * 16 + hexval(*num++);
} else {
/* decimal */
while (*num && isdigit(*num))
value = value * 10 + *num++ - '0';
}
return value;
}
float DIV_atof(FUNCTION_PARAMS)
{
const char *num = (const char*)getparm();
float value = 0;
if (num[0] == '0' && num[1] == 'x') {
/* hexadecimal */
num += 2;
while (*num && isxdigit(*num))
value = value * 16 + hexval(*num++);
} else {
/* decimal */
while (*num && isdigit(*num))
value = value * 10 + *num++ - '0';
}
return value;
}
char *DIV_lower(FUNCTION_PARAMS)
{
int i;
char *str=(char*)getparm();
if (!i_lower)
inicializa_lower();
for (i=0;str[i]!=0;i++) {
if (lower[str[i]]!=0) str[i]=lower[str[i]];
}
return str;
}
char *DIV_upper(FUNCTION_PARAMS)
{
int i;
char *str=(char*)getparm();
if (!i_upper)
inicializa_upper();
for (i=0;str[i]!=0;i++) {
if (upper[str[i]]!=0) str[i]=upper[str[i]];
}
return str;
}
/* Rutinas internas */
static int hexval(char c)
{
if (c >= '0' && c <= '9')
return c - '0';
else if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
else if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
return 0;
}

View file

@ -0,0 +1,3 @@
LIBRARY strings
EXPORTS
ExportaFuncs

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strings", "strings.vcproj", "{8983E45F-30DD-486C-AF5D-723E86BF5149}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{8983E45F-30DD-486C-AF5D-723E86BF5149}.Debug.ActiveCfg = Debug|Win32
{8983E45F-30DD-486C-AF5D-723E86BF5149}.Debug.Build.0 = Debug|Win32
{8983E45F-30DD-486C-AF5D-723E86BF5149}.Release.ActiveCfg = Release|Win32
{8983E45F-30DD-486C-AF5D-723E86BF5149}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="strings"
ProjectGUID="{8983E45F-30DD-486C-AF5D-723E86BF5149}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;STRINGS_EXPORTS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/strings.dll"
LinkIncremental="2"
ModuleDefinitionFile="../strings.def"
AddModuleNamesToAssembly="../strings.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/strings.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/strings.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;STRINGS_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/strings.dll"
LinkIncremental="1"
AddModuleNamesToAssembly="../strings.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/strings.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="codigo"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\conv.c">
</File>
<File
RelativePath="..\strings.c">
</File>
</Filter>
<Filter
Name="cabeceras"
Filter="h;hpp;hxx;hm;inl;inc">
<File
RelativePath="..\conv.h">
</File>
</Filter>
<Filter
Name="definiciones"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="..\strings.def">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

42
dlls/src/text/edivfont.h Normal file
View file

@ -0,0 +1,42 @@
/*
* eDiv Compiler
* Copyleft (C) 2000-2002 Sion Entertainment
* http://www.sion-e.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
-Estructura de control
contiene informacion sobre el offset y tamaño del bmp en el fichero .fnt
para poder leerlo, tambien contiene el offset de la estructura de informacion
-Mapa de caracteres
es la imagen del mapa de caracteres, se copia directamente.
*/
#ifndef __EDIV_EDIVFONT_H_
#define __EDIV_EDIVFONT_H_
#include <SDL/SDL.h>
struct _fuente_control_s{
int offset_imagen ;
int size_imagen ;
int w , h , bytespp ;
SDL_Rect rect[256] ;
SDL_Surface *imagen ;
};
#endif

400
dlls/src/text/text.c Normal file
View file

@ -0,0 +1,400 @@
#include <SDL/SDL.h>
#include <export.h>
#include "edivfont.h"
#include "text.h"
#define MAX_FONTS 0xFF
#define MAX_WRITES 0xFFF
struct _fuente_control_s fuente_control_s[MAX_FONTS];
int existe[MAX_FONTS] ;
struct
{
int existe ;
int numerica ; /* 0: texto , 1: numerica (write_int) */
int offset_var ; /* solo para numerica = 1 */
int centrado ; /* solo para numerica = 1 */
int fuente ; /* solo para numerica = 1 */
int x , y ;
int cx , cy ;
SDL_Surface *imagen ;
}textos[MAX_WRITES] ;
int ExportaFuncs(EXPORTAFUNCS_PARAMS)
{
CONST("all_text",0);
FUNCTION("load_fnt",1,eDiv_LoadFnt) ;
FUNCTION("write",5,eDiv_Write) ;
FUNCTION("write_int",5,eDiv_WriteInt) ;
FUNCTION("move_text",3,eDiv_MoveText) ;
FUNCTION("delete_text",1,eDiv_DeleteText) ;
ENTRYPOINT( frame ) ;
ENTRYPOINT(first_load) ;
return TRUE ;
}
FILE *fichero ;
int eDiv_LoadFnt(FUNCTION_PARAMS)
{
FILE *fuente ;
char *pool ;
int i ;
fpos_t pos ;
const char *filename=getstrparm(); /* Fichero a cargar */
for ( i = 1 ; i <= MAX_FONTS ; i++ )
{
if ( existe[i] == 0 )
break ;
}
if ( i == MAX_FONTS ) {
fp->Runtime_Error(113); /* Demasiadas fuentes */
return -1 ;
}
fichero = fopen("text.txt" , "w+" ) ;
if((fuente = fopen(filename, "rb" ))==NULL) {
fclose(fichero);
fp->Runtime_Error(114); /* archivo de fuente no encontrado */
return 0;
}
fprintf( fichero , "Leidos %d bytes\n" , (int)fread( &fuente_control_s[i] , 1 , sizeof(fuente_control_s[i]) , fuente ) ) ;
if (!(pool = malloc(fuente_control_s[i].size_imagen + 1 ) ) ) {
fp->Runtime_Error(100); /* memoria insuficiente */
return 0;
}
pos = fuente_control_s[i].offset_imagen ;
fsetpos(fuente , &pos ) ;
fprintf(fichero , "Size of image: %d bytes\n" , fuente_control_s[i].size_imagen ) ;
fprintf(fichero , "Leidos %d bytes\n" , (int)fread( pool , 1 , fuente_control_s[i].size_imagen , fuente ) ) ;
fuente_control_s[i].imagen = SDL_CreateRGBSurfaceFrom( pool , fuente_control_s[i].w , fuente_control_s[i].h , fuente_control_s[i].bytespp * 8 , fuente_control_s[i].w * fuente_control_s[i].bytespp , 0 , 0 , 0, 0 ) ;
fclose(fuente) ;
fclose(fichero) ;
existe[i] = 1 ;
return i ;
}
int eDiv_Write(FUNCTION_PARAMS)
{
int i , j ;
int ax ;
SDL_Rect dstrect ;
int fuente , x , y , centrado ;
int w , h ;
char *texto ;
texto = getstrparm() ;
centrado = getparm() ;
y = getparm() ;
x = getparm() ;
fuente = getparm() ;
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 == MAX_WRITES ) {
fp->Runtime_Error(118); /* demasiados textos */
return -1 ;
}
textos[i].x = x ;
textos[i].y = y ;
textos[i].numerica = 0 ;
textos[i].offset_var = 0 ;
textos[i].centrado = 0 ;
textos[i].fuente = 0 ;
/* Calculamos el ancho del fichero */
w = 0 ;
for ( j = 0 ; (unsigned)j < strlen(texto) ; j++ )
w += fuente_control_s[fuente].rect[ texto[j] ].w +1;
h = fuente_control_s[fuente].imagen->h ;
textos[i].imagen = SDL_CreateRGBSurface(SDL_HWSURFACE, w , h , fuente_control_s[fuente].bytespp * 8 , 0 , 0 , 0 , 0 ) ;
SDL_SetColorKey( textos[i].imagen , SDL_SRCCOLORKEY | SDL_RLEACCEL , 0 ) ;
/* Escribimos */
ax = 0 ; /* Valor de x acumulativo mientras se va escribiendo */
for ( j = 0 ; (unsigned)j < strlen(texto) ; j++ )
{
dstrect.x = ax ;
dstrect.y = fuente_control_s[fuente].rect[ texto[j] ].y ;
dstrect.w = fuente_control_s[fuente].rect[ texto[j] ].w ;
dstrect.h = fuente_control_s[fuente].rect[ texto[j] ].h ;
SDL_BlitSurface( fuente_control_s[fuente].imagen , &fuente_control_s[fuente].rect[ texto[j] ] , textos[i].imagen , &dstrect ) ;
ax += fuente_control_s[fuente].rect[ texto[j] ].w +1 ;
}
/* Centrado */
if ( centrado == 0 || centrado == 3 || centrado == 6 )
textos[i].cx = 0 ;
if ( centrado == 1 || centrado == 4 || centrado == 7 )
textos[i].cx = (int) textos[i].imagen->w / 2 ;
if ( centrado == 2 || centrado == 5 || centrado == 8 )
textos[i].cx = textos[i].imagen->w -1 ;
if ( centrado > -1 && centrado < 3 )
textos[i].cy = 0 ;
if ( centrado > 2 && centrado < 6 )
textos[i].cy = (int) textos[i].imagen->h / 2 ;
if ( centrado > 5 && centrado < 9 )
textos[i].cy = textos[i].imagen->h -1 ;
textos[i].existe = 1 ;
return i ;
}
int eDiv_WriteInt(FUNCTION_PARAMS)
{
int i , j ;
int w , h , ax ;
SDL_Rect dstrect ;
int fuente , x , y , centrado , offset_var ;
char *texto ;
char texto2[30] ;
offset_var = getparm() ;
centrado = getparm() ;
y = getparm() ;
x = getparm() ;
fuente = getparm() ;
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 == MAX_WRITES ) {
fp->Runtime_Error(118); /* demasiados textos */
return -1 ;
}
textos[i].x = x ;
textos[i].y = y ;
textos[i].numerica = 1 ;
textos[i].offset_var = offset_var ;
textos[i].centrado = centrado ;
textos[i].fuente = fuente ;
fichero = fopen("wrin.txt" , "w+") ;
fprintf( fichero , "valor: %i\n" , global("fps") ) ;
fclose(fichero) ;
itoa( fp->mem[ textos[i].offset_var ] , texto2 , 10 ) ;
texto = texto2 ;
/* Calculamos el ancho del fichero */
w = 0 ;
for ( j = 0 ; (unsigned)j < strlen(texto) ; j++ )
w += fuente_control_s[fuente].rect[ texto[j] ].w +1;
h = fuente_control_s[fuente].imagen->h ;
textos[i].imagen = SDL_CreateRGBSurface(SDL_HWSURFACE, w , h , fuente_control_s[fuente].bytespp * 8 , 0 , 0 , 0 , 0 ) ;
SDL_SetColorKey( textos[i].imagen , SDL_SRCCOLORKEY | SDL_RLEACCEL , 0 ) ;
/* Escribimos */
ax = 0 ; /* Valor de x acumulativo mientras se va escribiendo */
for ( j = 0 ; (unsigned)j < strlen(texto) ; j++ )
{
dstrect.x = ax ;
dstrect.y = fuente_control_s[fuente].rect[ texto[j] ].y ;
dstrect.w = fuente_control_s[fuente].rect[ texto[j] ].w ;
dstrect.h = fuente_control_s[fuente].rect[ texto[j] ].h ;
SDL_BlitSurface( fuente_control_s[fuente].imagen , &fuente_control_s[fuente].rect[ texto[j] ] , textos[i].imagen , &dstrect ) ;
ax += fuente_control_s[fuente].rect[ texto[j] ].w +1 ;
}
/* Centrado */
if ( centrado == 0 || centrado == 3 || centrado == 6 )
textos[i].cx = 0 ;
if ( centrado == 1 || centrado == 4 || centrado == 7 )
textos[i].cx = (int) textos[i].imagen->w / 2 ;
if ( centrado == 2 || centrado == 5 || centrado == 8 )
textos[i].cx = textos[i].imagen->w -1 ;
if ( centrado > -1 && centrado < 3 )
textos[i].cy = 0 ;
if ( centrado > 2 && centrado < 6 )
textos[i].cy = (int) textos[i].imagen->h / 2 ;
if ( centrado > 5 && centrado < 9 )
textos[i].cy = textos[i].imagen->h -1 ;
textos[i].existe = 1 ;
return i ;
}
int eDiv_MoveText(FUNCTION_PARAMS)
{
int i , x , y ;
y = getparm() ;
x = getparm() ;
i = getparm() ;
textos[i].x = x ;
textos[i].y = y ;
return 1 ;
}
int eDiv_DeleteText(FUNCTION_PARAMS)
{
int i;
i = getparm();
if (i==0) {
for (i=1;i<MAX_WRITES;i++) {
if(textos[i].existe) {
/* Por que esta comentado esto: */
/* SDL_FreeSurface(textos[i].imagen) ; */
textos[i].existe=0;
}
}
return 1;
}
else if (i<1 || i>MAX_WRITES) {
fp->Runtime_Error(119); /* id de texto no válido */
return -1 ;
}
textos[i].existe = 0;
return 1;
}
/*
* Entrypoints
*/
void frame(FUNCTION_PARAMS)
{
SDL_Rect srcrect, dstrect;
char *texto;
char texto2[30];
int i, j;
int w, h, ax;
for (i=0; i<0xFFF ;i++)
if ( textos[i].existe )
{
if ( textos[i].numerica )
{
SDL_FreeSurface( textos[i].imagen ) ;
itoa( fp->mem[ textos[i].offset_var ] , texto2 , 10 ) ;
texto = texto2 ;
/* Calculamos el ancho del fichero */
w = 0 ;
for ( j = 0 ; (unsigned)j < strlen(texto) ; j++ )
w += fuente_control_s[textos[i].fuente].rect[ texto[j] ].w +1;
h = fuente_control_s[textos[i].fuente].imagen->h ;
textos[i].imagen = SDL_CreateRGBSurface(SDL_HWSURFACE, w , h , fuente_control_s[textos[i].fuente].bytespp * 8 , 0 , 0 , 0 , 0 ) ;
SDL_SetColorKey( textos[i].imagen , SDL_SRCCOLORKEY | SDL_RLEACCEL , 0 ) ;
/* Escribimos */
ax = 0 ; /* Valor de x acumulativo mientras se va escribiendo */
for ( j = 0 ; (unsigned)j < strlen(texto) ; j++ )
{
dstrect.x = ax ;
dstrect.y = fuente_control_s[textos[i].fuente].rect[ texto[j] ].y ;
dstrect.w = fuente_control_s[textos[i].fuente].rect[ texto[j] ].w ;
dstrect.h = fuente_control_s[textos[i].fuente].rect[ texto[j] ].h ;
SDL_BlitSurface( fuente_control_s[textos[i].fuente].imagen , &fuente_control_s[textos[i].fuente].rect[ texto[j] ] , textos[i].imagen , &dstrect ) ;
ax += fuente_control_s[textos[i].fuente].rect[ texto[j] ].w +1 ;
}
/* Centrado */
if ( textos[i].centrado == 0 || textos[i].centrado == 3 || textos[i].centrado == 6 )
textos[i].cx = 0 ;
if ( textos[i].centrado == 1 || textos[i].centrado == 4 || textos[i].centrado == 7 )
textos[i].cx = (int) textos[i].imagen->w / 2 ;
if ( textos[i].centrado == 2 || textos[i].centrado == 5 || textos[i].centrado == 8 )
textos[i].cx = textos[i].imagen->w -1 ;
if ( textos[i].centrado > -1 && textos[i].centrado < 3 )
textos[i].cy = 0 ;
if ( textos[i].centrado > 2 && textos[i].centrado < 6 )
textos[i].cy = (int) textos[i].imagen->h / 2 ;
if ( textos[i].centrado > 5 && textos[i].centrado < 9 )
textos[i].cy = textos[i].imagen->h -1 ;
}
srcrect.x = 0 ;
srcrect.y = 0 ;
srcrect.w = textos[i].imagen->w ;
srcrect.h = textos[i].imagen->h ;
dstrect.x = textos[i].x - textos[i].cx ;
dstrect.y = textos[i].y - textos[i].cy ;
dstrect.w = srcrect.w ;
dstrect.h = srcrect.h ;
fp->Dibuja( textos[i].imagen , srcrect, dstrect , 0 , 255 , 0 , 0 ) ;
}
/*
* de momento solo hay esta demostracion de que fp->Dibuja funciona xDD
* falta hacer los scrolls :P
*/
/*
if ( fp->existe.dibuja )
{
if ( fp->files[0].existe )
{
if ( fp->files[0].mapa[1000].existe )
{
srcrect.x = 0 ;
srcrect.y = 0 ;
srcrect.w = fp->files[0].mapa[1000].Surface->w ;
srcrect.h = fp->files[0].mapa[1000].Surface->h ;
fp->Dibuja( fp->files[0].mapa[1000].Surface , srcrect , srcrect , 0 , 128 ) ;
}
}
}
*/
}
void first_load(FUNCTION_PARAMS)
{
int i ;
for ( i = 0 ; i < 256 ; i++ )
existe[i] = 0 ;
for ( i = 0 ; i < 1024 ; i++ )
textos[i].existe = 0 ;
}

3
dlls/src/text/text.def Normal file
View file

@ -0,0 +1,3 @@
LIBRARY text
EXPORTS
ExportaFuncs

10
dlls/src/text/text.h Normal file
View file

@ -0,0 +1,10 @@
#ifndef __EDIV_TEXT_H_
#define __EDIV_TEXT_H_
int eDiv_LoadFnt(FUNCTION_PARMAS);
int eDiv_Write(FUNCTION_PARAMS);
int eDiv_WriteInt(FUNCTION_PARAMS);
int eDiv_MoveText(FUNCTION_PARAMS);
int eDiv_DeleteText(FUNCTION_PARAMS);
#endif

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "text", "text.vcproj", "{71D05C32-B49A-4690-AA4D-1385D4257CDF}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{71D05C32-B49A-4690-AA4D-1385D4257CDF}.Debug.ActiveCfg = Debug|Win32
{71D05C32-B49A-4690-AA4D-1385D4257CDF}.Debug.Build.0 = Debug|Win32
{71D05C32-B49A-4690-AA4D-1385D4257CDF}.Release.ActiveCfg = Release|Win32
{71D05C32-B49A-4690-AA4D-1385D4257CDF}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,140 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="text"
ProjectGUID="{71D05C32-B49A-4690-AA4D-1385D4257CDF}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TEXT_EXPORTS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sdlmain.lib sdl.lib"
OutputFile="$(OutDir)/text.dll"
LinkIncremental="2"
ModuleDefinitionFile="../text.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/text.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/text.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Release"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TEXT_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"
CompileAs="1"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sdlmain.lib sdl.lib"
OutputFile="$(OutDir)/text.dll"
LinkIncremental="1"
ModuleDefinitionFile="../text.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/text.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="codigo"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\text.c">
</File>
</Filter>
<Filter
Name="cabeceras"
Filter="h;hpp;hxx;hm;inl;inc">
<File
RelativePath="..\edivfont.h">
</File>
<File
RelativePath="..\text.h">
</File>
</Filter>
<Filter
Name="definiciones"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="..\text.def">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

63
dlls/src/win32/dlls.sln Normal file
View file

@ -0,0 +1,63 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dinmem", "..\dinmem\win32\dinmem.vcproj", "{2FD59E33-AB54-47EC-A3E5-3619A3921ABF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "edivstd", "..\edivstd\win32\edivstd.vcproj", "{92B930FB-7B7F-4DD6-A50C-8DE8E34461C2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "file", "..\file\win32\file.vcproj", "{EA869297-5AC6-4603-BB86-9962207DB25F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\graphics\win32\graphics.vcproj", "{20CF9907-2F82-4A8C-A5FB-074F5F1BCB32}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "input", "..\input\win32\input.vcproj", "{92E50294-4312-49E4-848B-5C9FF43AB27D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "math", "..\math\win32\math.vcproj", "{56A4746D-5A73-4CA5-BD0C-959F14B503E7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strings", "..\strings\win32\strings.vcproj", "{8983E45F-30DD-486C-AF5D-723E86BF5149}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "text", "..\text\win32\text.vcproj", "{71D05C32-B49A-4690-AA4D-1385D4257CDF}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{2FD59E33-AB54-47EC-A3E5-3619A3921ABF}.Debug.ActiveCfg = Debug|Win32
{2FD59E33-AB54-47EC-A3E5-3619A3921ABF}.Debug.Build.0 = Debug|Win32
{2FD59E33-AB54-47EC-A3E5-3619A3921ABF}.Release.ActiveCfg = Release|Win32
{2FD59E33-AB54-47EC-A3E5-3619A3921ABF}.Release.Build.0 = Release|Win32
{92B930FB-7B7F-4DD6-A50C-8DE8E34461C2}.Debug.ActiveCfg = Debug|Win32
{92B930FB-7B7F-4DD6-A50C-8DE8E34461C2}.Debug.Build.0 = Debug|Win32
{92B930FB-7B7F-4DD6-A50C-8DE8E34461C2}.Release.ActiveCfg = Release|Win32
{92B930FB-7B7F-4DD6-A50C-8DE8E34461C2}.Release.Build.0 = Release|Win32
{EA869297-5AC6-4603-BB86-9962207DB25F}.Debug.ActiveCfg = Debug|Win32
{EA869297-5AC6-4603-BB86-9962207DB25F}.Debug.Build.0 = Debug|Win32
{EA869297-5AC6-4603-BB86-9962207DB25F}.Release.ActiveCfg = Release|Win32
{EA869297-5AC6-4603-BB86-9962207DB25F}.Release.Build.0 = Release|Win32
{20CF9907-2F82-4A8C-A5FB-074F5F1BCB32}.Debug.ActiveCfg = Debug|Win32
{20CF9907-2F82-4A8C-A5FB-074F5F1BCB32}.Debug.Build.0 = Debug|Win32
{20CF9907-2F82-4A8C-A5FB-074F5F1BCB32}.Release.ActiveCfg = Release|Win32
{20CF9907-2F82-4A8C-A5FB-074F5F1BCB32}.Release.Build.0 = Release|Win32
{92E50294-4312-49E4-848B-5C9FF43AB27D}.Debug.ActiveCfg = Debug|Win32
{92E50294-4312-49E4-848B-5C9FF43AB27D}.Debug.Build.0 = Debug|Win32
{92E50294-4312-49E4-848B-5C9FF43AB27D}.Release.ActiveCfg = Release|Win32
{92E50294-4312-49E4-848B-5C9FF43AB27D}.Release.Build.0 = Release|Win32
{56A4746D-5A73-4CA5-BD0C-959F14B503E7}.Debug.ActiveCfg = Debug|Win32
{56A4746D-5A73-4CA5-BD0C-959F14B503E7}.Debug.Build.0 = Debug|Win32
{56A4746D-5A73-4CA5-BD0C-959F14B503E7}.Release.ActiveCfg = Release|Win32
{56A4746D-5A73-4CA5-BD0C-959F14B503E7}.Release.Build.0 = Release|Win32
{8983E45F-30DD-486C-AF5D-723E86BF5149}.Debug.ActiveCfg = Debug|Win32
{8983E45F-30DD-486C-AF5D-723E86BF5149}.Debug.Build.0 = Debug|Win32
{8983E45F-30DD-486C-AF5D-723E86BF5149}.Release.ActiveCfg = Release|Win32
{8983E45F-30DD-486C-AF5D-723E86BF5149}.Release.Build.0 = Release|Win32
{71D05C32-B49A-4690-AA4D-1385D4257CDF}.Debug.ActiveCfg = Debug|Win32
{71D05C32-B49A-4690-AA4D-1385D4257CDF}.Debug.Build.0 = Debug|Win32
{71D05C32-B49A-4690-AA4D-1385D4257CDF}.Release.ActiveCfg = Release|Win32
{71D05C32-B49A-4690-AA4D-1385D4257CDF}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal