Autor Tema: new articles on the wiki  (Leído 12504 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
new articles on the wiki
« en: Marzo 16, 2012, 07:08:22 am »
As suggested by DoctorN, I decided to create new topic for this.

Currently I'm working on mod_map, and have added/modified so far:

- pcx_load
- bdf_load
- get_rgb  / get_rgba (needs checking for correctness)
- rgb / rgba (extra optional "depth" parameter  as once desired by Sandman in this topic: http://forum.bennugd.org/index.php?topic=312.msg3622#msg3622, modified article needs checking by Spliter or other expert)

- graphic_set (is the same thing as map_info_set)
- map_info / map_info_get
- map_buffer


I have a lot of trouble with fnt_new. It doesn't seem to work for me: http://forum.bennugd.org/index.php?topic=3012.0. Some more comments in bennu's own sourcecode would be helpfull in general.  ;D ;)

I might have found a bug in get_colors() and set_colors().  Both functions crash bennu when I try to use them. The bennupack example in
Código: [Seleccionar]
2 Medium\fenix test\Fenix Test3\test_GET_COLORS.prg  (and test_set_colors.prg) do not run sucessfully. They seem to crash.

I've looked in the bennu souce 
Código: [Seleccionar]
modules/libgrbase/g_pal.c and found this in the functions pal_get() and pal_set():
in pal_get()
Código: [Seleccionar]

539     *pal++ = spal->rgb[ color ].r ;
540     *pal++ = spal->rgb[ color ].g ;
541     *pal++ = spal->rgb[ color++ ].b ;


in pal_set()
 
Código: [Seleccionar]

 561     spal->rgb[ color ].r = *pal++ ;
562     spal->rgb[ color ].g = *pal++ ;
563     spal->rgb[ color++ ].b = *pal++ ;
 


the lines 541 and 563 seem a bit odd :-\ . Why whould have to different from 540, 541, 561 and 562? Maybe the cause of the problem? I've searched on the spanish section and there was some problem mentioned: http://forum.bennugd.org/index.php?topic=464.msg6025#msg6025. Maybe the bug is still around?

« última modificación: Marzo 16, 2012, 11:28:57 am por handsource-dyko »

Conectado SplinterGU

  • Hero Member
  • *****
  • Mensajes: 12414
  • Karma: 366
  • Sexo: Masculino
    • Ver Perfil
Re:new articles on the wiki
« Respuesta #1 en: Marzo 16, 2012, 02:32:27 pm »
code sample... please.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:new articles on the wiki
« Respuesta #2 en: Marzo 17, 2012, 04:39:11 am »
Spliter, here's the code that crashes. It is an reworked fenix test sample from bennupack, that I tydied up for the wiki:

Código: [Seleccionar]
IMPORT "mod_say";
IMPORT "mod_debug";
IMPORT "mod_key";
IMPORT "mod_map";
IMPORT "mod_video";
IMPORT "mod_wm";
IMPORT "mod_draw";
IMPORT "mod_screen";
IMPORT "mod_text";
IMPORT "mod_timers";


GLOBAL

  STRUCT original_palette[255];
    byte r;
    byte g;
    byte b;
  END
 
  STRUCT new_palette[255];
    byte r;
    byte g;
    byte b;
  END
 
  int count;
  int set_palette;
  int color_index_number;

  int status;
 
PROCESS main();
 
BEGIN

   write(0,10,10,3,"Test GET_COLORS para Fenix...");
   write(0,160,35,4,"Get Colors Paleta...");
   write(0,160,190,4,"Pulsa ESC para Salir...");
 
   x=160;
   y=115;
 
   graph=new_map(16,16,8);
   size=800;
 
   FOR (count=0; count<256; count++)
      new_palette[count].r=0;
      new_palette[count].g=count;
      new_palette[count].b=0;
      say("count: "+count);
   END

   
   say("status: "+status);
   status=get_colors(0,256,&original_palette); // it crashes here
   say("status: "+status);

   say("status: "+status);
   status=set_colors(0,256,&new_palette); // this one too, same thing, it crashes
   say("status: "+status);

   draw_palette();
   
   LOOP
   
      IF (key(_esc))
         BREAK;
      END
     
      IF (key(_enter) AND set_palette==0)
         FRAME(100);
         set_colors(0,256,&original_palette);
         set_palette=1;
      END
     
      IF (key(_enter) AND set_palette==1)
         FRAME(100);
         set_colors(0,256,&new_palette);
         set_palette=0;
      END
     
      FRAME;     
   END
 
   timer[0]=0;
 
   REPEAT
 
      IF (timer[0]>=300 AND NOT set_palette)
         set_colors(0,256,&original_palette);
         set_palette=1;
         timer[0]=0;
      END
   
      IF (timer[0]>=300 AND set_palette)
         set_colors(0,256,&new_palette);
         set_palette=0;
         timer[0]=0;
      END
   
      FRAME;
   UNTIL(key(_esc))
 
END // end of main program



PROCESS draw_palette();

BEGIN

   say("drawing palette");
   color_index_number=0;
   
   FROM y=0 TO 15;
 
      FROM x=0 TO 15;
         map_put_pixel(0,father.graph,x,y,color_index_number);
         color_index_number++;
         say("color_index_number"+color_index_number);
      END
   
   END
 
END


It seems that both set_colors and get_colors crash, and I think it has something to do with line 541 and line 563 in g_pal.c, but that's just out curiousity when I looked for the paramters of the function, and I wondered why these two lines are different.

Conectado SplinterGU

  • Hero Member
  • *****
  • Mensajes: 12414
  • Karma: 366
  • Sexo: Masculino
    • Ver Perfil
Re:new articles on the wiki
« Respuesta #3 en: Marzo 17, 2012, 08:57:08 am »
fixed, thanks!
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:new articles on the wiki
« Respuesta #4 en: Marzo 17, 2012, 09:00:21 am »
Ok! :)

I added most of the palette functions to the wiki (thanks to bomerlink for those good examples in bennupack).
These are still to be added:

- convert_palette()
- roll_palette()
- pal_sys_set()

The rest of the palette functions are done!

Desconectado MisterN

  • Hero Member
  • *****
  • Mensajes: 650
  • Karma: 4
    • Ver Perfil
Re:new articles on the wiki
« Respuesta #5 en: Marzo 17, 2012, 11:28:08 am »
I just sent you an email about text's
werg

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:new articles on the wiki
« Respuesta #6 en: Marzo 18, 2012, 05:53:54 am »
Added roll_palette(), convert_palette() and fixed fnt_new() (with example). I would like to be able to upload images to the wiki for certain articles.

Still trying to figure out what pal_sys_set() does. It looks like pal_refresh() but doesn't seem to behave the same way. If anybody knows exactly, please let me know. The function is mysterious and I don't think it really necessary in most cases.

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:new articles on the wiki
« Respuesta #7 en: Marzo 19, 2012, 06:45:46 am »
get_colors()
set_colors()

sound_init()
sound_close()

have been added, but need checking. I'm unsure of some things. I think that get_colors and set_colors are the same as pal_get and pal_set, but with a few small differences I cannot really pinpoint.

Still to do:

- background loader functions (can wait untill later)
- joy_get_accell (cannoo specific???)
- pal_sys_set

Besides these things I consider it pretty much done for now, untill new functions and features are made. If you have find an error somewhere, you can change it.

Desconectado MisterN

  • Hero Member
  • *****
  • Mensajes: 650
  • Karma: 4
    • Ver Perfil
Re:new articles on the wiki
« Respuesta #8 en: Marzo 24, 2012, 06:03:28 pm »
I think that this is truly what bennugd needs because people like me only know so much and we get all this stuff to study from once it comes out XD
werg

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:new articles on the wiki
« Respuesta #9 en: Marzo 25, 2012, 02:23:54 am »
It would be nice if Sandman were to show up again. He knows a lot about the internals. I looked in bennu's source code for most of the stuff. But it's not not easy you if only know a few small things about C. I've got a book about C that I read a lot, so I understand the basics although I don't write C programs myself (c compilers and make files are insanely complicated  ;D ).  Some functions are easier to document then others, because some are mapped to standard C functions and the sound stuff I could find in SDL articles. But what I don't understand is why the code itself is so sparse on internal documentation (function body's with explaination of what each function does, and what arguments it expects ??? ). It is so cryptic sometimes! :( Well it helps that I still have my DIV manual and documentation wich made it easier to do certain articles. Especially the scroll and mode7 stuff, I can imagine it's a bit mysterious if you don't have examples.

Desconectado l1nk3rn3l

  • Hero Member
  • *****
  • Mensajes: 1804
  • Karma: 244
  • Sexo: Masculino
    • Ver Perfil
Re:new articles on the wiki
« Respuesta #10 en: Marzo 25, 2012, 04:38:54 am »
thx for you work.. wiki now is more big..

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:new articles on the wiki
« Respuesta #11 en: Marzo 25, 2012, 04:48:37 am »
Of course before I forget, the samples in bennu pack are a great resource, too. I used and converted some of them for the examples by the articles on the wiki. ;) This also why some palette functions are now fixed, simply because I tested an old fenix test sample with bennu, and it didn't work, but now it does with the latest version.  :) (This is what they call regression testing). And I wouldn't have figured out the working of the pathfinding functions if it wasn't for TYCO's example. It really helped me out.

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:new articles on the wiki
« Respuesta #12 en: Marzo 26, 2012, 06:39:24 am »
Updates completed:

- now if set_mode fail return -1, else return 0 <DONE>/UPDATED


- Add new functions <DONE>/UPDATED
WRITE* (fontid, x, y, z, alignm, ...)      <DONE>/UPDATED
WRITE_int (fontid, x, y, z, alignm, ...)   <DONE>/UPDATED
WRITE_string (fontid, x, y, z, alignm, ...)<DONE>/UPDATED
WRITE_var (fontid, x, y, z, alignm, ...)   <DONE>/UPDATED
WRITE_float (fontid, x, y, z, alignm, ...) <DONE>/UPDATED
SET_TEXT_COLOR(textid, color)              <DONE>/UPDATED
GET_TEXT_COLOR(textid)                     <DONE>/UPDATED
MOVE_TEXT(textid, x, y, z)                 <DONE>/UPDATED

- add new backgound load functions <DONE>
LOAD_MAP(filename, &id) <DONE>
LOAD_PNG(filename, &id) <DONE>
LOAD_PCX(filename, &id) <DONE>
LOAD_FPG(filename, &id) <DONE>/MODIFIED
LOAD_SONG(filename, &id)<DONE>
LOAD_WAV(filename, &id) <DONE>
LOAD_PAL(filename, &id) <DONE>
LOAD_FNT(filename, &id) <DONE>
LOAD_BDF(filename, &id) <DONE>
MAP_LOAD(filename, &id) <DONE>
PNG_LOAD(filename, &id) <DONE>
PCX_LOAD(filename, &id) <DONE>
FPG_LOAD(filename, &id) <DONE>/MODIFIED
SONG_LOAD(filename, &id)<DONE>
WAV_LOAD(filename, &id) <DONE>
PAL_LOAD(filename, &id) <DONE>
FNT_LOAD(filename, &id) <DONE>
BDF_LOAD(filename, &id) <DONE>

With most of these updates I added a note that the "modifications" apply to version rc282 and newer, so that people that use older versions don't get confused.

Conectado gecko

  • Hero Member
  • *****
  • Mensajes: 730
  • Karma: 45
  • Sexo: Masculino
    • Ver Perfil
    • Torres Baldi Studio
Re:new articles on the wiki
« Respuesta #13 en: Marzo 26, 2012, 03:50:17 pm »
a big karma for you! :)
Torres Baldi Studio
http://torresbaldi.com

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:new articles on the wiki
« Respuesta #14 en: Marzo 27, 2012, 12:41:51 am »
Thanks! :)