Ya he unido todo.
Por cierto, SplinterGU, he tenido que modificar algunas cabeceras de BennuGD para que compilen bien con C++, resulta que me daban un montón de "undefined references" aún enlazando con las libs donde estaban las funciones que decía que no tenían referencia, y de casualidad he descubierto que hay que poner extern "C" en las funciones para que las pille C++.
Así que estos son los cambios que hay que introducir para que funcione la compilación de mod_smpeg
g_bitmap.h
#ifdef __cplusplus
#define C_SYMBOL "C"
#else
#define C_SYMBOL ""
#endif
extern C_SYMBOL GRAPH * bitmap_new( int code, int w, int h, int depth );
extern C_SYMBOL GRAPH * bitmap_new_ex( int code, int w, int h, int depth, void * data, int pitch );
extern C_SYMBOL GRAPH * bitmap_clone( GRAPH * t );
extern C_SYMBOL GRAPH * bitmap_new_syslib( int w, int h, int depth );
extern C_SYMBOL void bitmap_destroy( GRAPH * map );
extern C_SYMBOL void bitmap_destroy_fake( GRAPH * map );
extern C_SYMBOL void bitmap_add_cpoint( GRAPH *map, int x, int y );
extern C_SYMBOL void bitmap_set_cpoint( GRAPH * map, uint32_t point, int x, int y );
extern C_SYMBOL void bitmap_analize( GRAPH * bitmap );
extern C_SYMBOL PIXEL_FORMAT * bitmap_create_format( int bpp );
extern C_SYMBOL int bitmap_next_code();
g_grlib.h
#ifdef __cplusplus
#define C_SYMBOL "C"
#else
#define C_SYMBOL ""
#endif
extern C_SYMBOL GRAPH * bitmap_get( int libid, int mapcode ) ;
extern C_SYMBOL GRLIB * grlib_get( int libid ) ;
extern C_SYMBOL void grlib_init() ;
extern C_SYMBOL int grlib_new() ;
extern C_SYMBOL void grlib_destroy( int libid ) ;
extern C_SYMBOL int grlib_add_map( int libid, GRAPH * map ) ;
extern C_SYMBOL int grlib_unload_map( int libid, int mapcode ) ;
#ifdef __cplusplus
#define C_SYMBOL "C"
#else
#define C_SYMBOL ""
#endif
extern C_SYMBOL void _string_ptoa( char *t, void * p );
extern C_SYMBOL void _string_ntoa( char *p, unsigned long n );
extern C_SYMBOL void _string_utoa( char *p, unsigned long n );
extern C_SYMBOL void string_init() ;
extern C_SYMBOL const char * string_get( int code ) ;
extern C_SYMBOL void string_dump( void ( *wlog )( const char *fmt, ... ) );
extern C_SYMBOL void string_load( void *, int, int, int, int ) ;
extern C_SYMBOL int string_new( const char * ptr ) ;
extern C_SYMBOL int string_newa( const char * ptr, unsigned count ) ;
extern C_SYMBOL void string_use( int code ) ;
extern C_SYMBOL void string_discard( int code ) ;
extern C_SYMBOL int string_add( int code1, int code2 ) ;
extern C_SYMBOL int string_compile( const char ** source ) ;
extern C_SYMBOL int string_itoa( int n ) ;
extern C_SYMBOL int string_uitoa( unsigned int n ) ;
extern C_SYMBOL int string_ftoa( float n ) ;
extern C_SYMBOL int string_ptoa( void * n ) ;
extern C_SYMBOL int string_comp( int code1, int code2 ) ;
extern C_SYMBOL int string_casecmp( int code1, int code2 ) ;
extern C_SYMBOL int string_char( int n, int nchar ) ;
extern C_SYMBOL int string_substr( int code, int first, int len ) ;
extern C_SYMBOL int string_find( int code1, int code2, int first ) ;
extern C_SYMBOL int string_ucase( int code1 ) ;
extern C_SYMBOL int string_lcase( int code1 ) ;
extern C_SYMBOL int string_strip( int code ) ;
extern C_SYMBOL int string_pad( int code, int length, int align ) ;
extern C_SYMBOL int string_format( double number, int dec, char point, char thousands ) ;
extern C_SYMBOL int string_concat( int code1, char * str2 ) ;
Sería muy pelotudo si pudieras introducirlo en bennu para posteriores versiones, ya que si no a cada versión nueva de benno que hagas me tocaría ir indagando dónde poner el extern "C" y con esto es automático para que funcione en C a secas y en CPP.
Por otro lado, necesito un poquitín de más de tu ayuda con la mod_smpeg.
Resulta que ya tengo todo programado, tanto cargar en un map como cargar varios mpegs a la vez.
Ahora el problema lo tengo con load_in_screen. Quiero hacer que se carge en la pantalla directamente (como lo hace por ejemplo put_screen) y así poder tener el video de fondo y tal,ya lo tengo programado pero resulta que no se me dibuja en pantalla.
Creo que es porque no se recuperar el SDL_surface del map 0,0. Te pongo el código fuente en concreto
static int f_load_in_screen(INSTANCE * my, int * params)
{
const char *filename = string_get(params[0]);
int w, h, bpp ;
PIXEL_FORMAT * pf;
GRAPH * map = NULL ;
int index;
SDL_Surface * screen;
index = get_next_index();
if (index <0) return -1;
map = bitmap_get(0,0);
/* Calculate the row size (dword-aligned) */
w = map->width;
h = map->height;
bpp = map->format->depth;
pf = bitmap_create_format( bpp );
screen = SDL_CreateRGBSurface( 0,
w,
h,
bpp,
pf->Rmask,
pf->Gmask,
pf->Bmask,
pf->Amask
);
v_movie[index] = new SDL_Movie;
v_movie[index]->Load( filename, screen);
string_discard(params[0]);
free( pf );
v_movie[index]->map_code = map->code;
return index;
}
Adjunto codigo fuente completo, última dll compilada y test.prg de pruebas.