new articles on the wiki

Started by handsource-dyko, March 16, 2012, 03:08:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


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:, 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: 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 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  modules/libgrbase/g_pal.c and found this in the functions pal_get() and pal_set():
in pal_get()

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

in pal_set()

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: Maybe the bug is still around?


Download Lastest BennuGD Release:


Spliter, here's the code that crashes. It is an reworked fenix test sample from bennupack, that I tydied up for the wiki:

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";


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

  int status;
PROCESS main();


   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...");
   FOR (count=0; count<256; count++)
      say("count: "+count);

   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);

      IF (key(_esc))
      IF (key(_enter) AND set_palette==0)
      IF (key(_enter) AND set_palette==1)

      IF (timer[0]>=300 AND NOT set_palette)
      IF (timer[0]>=300 AND set_palette)

END // end of main program

PROCESS draw_palette();


   say("drawing palette");
   FROM y=0 TO 15;
      FROM x=0 TO 15;

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.


Download Lastest BennuGD Release:


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!


I just sent you an email about text's


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.




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.


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


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.


thx for you work.. wiki now is more big..


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.


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.


Torres Baldi Studio