Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

BLOAD saved GIF=done PUT sprite=?

Dr. COM WIZDr. COM WIZ Member Posts: 74
Hello, World!
This is Dr. COM WIZ. As you know, I am in game production. I ran into yet anpother disturbing problem with graphics.

I found an article on tile art and starting drawing a tile in a very good graphics program (ArtGem). I saved it in a GIF file expecting to be able to BSAVE and BLOAD it successfuly. I BSAVED it with the aid of a QBasic GIF file loader and everything seemed to be fine until I actually tried to BLOAD it in a different program. It was originally a grass tile (yes, the legendery grass tile) but, wen I PUT it, came out to be a square of randomly colored pixels. It worked OK when I PUT it in the same program I BSAVED it, but when I BLOADed on a different one, I got something equvilent to what would be made by this

[code]
SCREEN 13
DO
PSET(16 * RND, 16 * RND), 16 * RND
LOOP
'This program was not tested
[/code]

Except it wasn't animated. It probably has something to do with the PALLETTE that the GIF Loader used. I don't know. Please help!
The GIF loader can be found at:
http://www.qbasic.com/files/gif.bas

In the mean time, I'll try another GIF loader and see what happens.


This has been,
Dr. COM WIZ
PS Thank you and goodnight!

Comments

  • billywm664billywm664 Member Posts: 176
    I get problems like this sometimes with bload/bsave, and it usually turns out to be the method by which I saved it --> Like, for example, it might throw errors at me when my array i bsaved with was too small.
    So, maybe looking over the saving code would help.

    Like you said, it may also be the palette. Does the tile looking something like the original, just with funky colors?

    : Hello, World!
    : This is Dr. COM WIZ. As you know, I am in game production. I ran into yet anpother disturbing problem with graphics.
    :
    : I found an article on tile art and starting drawing a tile in a very good graphics program (ArtGem). I saved it in a GIF file expecting to be able to BSAVE and BLOAD it successfuly. I BSAVED it with the aid of a QBasic GIF file loader and everything seemed to be fine until I actually tried to BLOAD it in a different program. It was originally a grass tile (yes, the legendery grass tile) but, wen I PUT it, came out to be a square of randomly colored pixels. It worked OK when I PUT it in the same program I BSAVED it, but when I BLOADed on a different one, I got something equvilent to what would be made by this
    :
    : [code]
    : SCREEN 13
    : DO
    : PSET(16 * RND, 16 * RND), 16 * RND
    : LOOP
    : 'This program was not tested
    : [/code]
    :
    : Except it wasn't animated. It probably has something to do with the PALLETTE that the GIF Loader used. I don't know. Please help!
    : The GIF loader can be found at:
    : http://www.qbasic.com/files/gif.bas
    :
    : In the mean time, I'll try another GIF loader and see what happens.
    :
    :
    : This has been,
    : Dr. COM WIZ
    : PS Thank you and goodnight!
    :

  • MainForzeMainForze Member Posts: 36
    [b][red]This message was edited by the MainForze at 2002-2-27 1:32:43[/red][/b][hr]
    Yep, it IS the palette. A GIF image has it's palette stored in the file. A BSAVE'd image hasn't. Have a look the BSAVE's images file-size. If your tile was 64x64, it's file-size should be 64x64+3 (or 4, not sure). These extra bytes remember the images dimensions.

    You should modify the GIF loader to save the palette too. To do this, let the loader put the image onscreen, then save the colors like this:

    [code]
    TYPE RGB
    red AS INTEGER
    blue AS INTEGER
    green as INTEGER
    END TYPE
    DIM pal(255) as RGB
    FOR x = 0 TO 255
    OUT &H3C7, x
    pal(x).red = INP(&H3C9)
    pal(x).blue = INP(&H3C9)
    pal(x).green = INP(&H3C9)
    NEXT x

    'I typed the code out of my head so I might have gotten a
    'couple of things wrong, especially the port numbers...
    [/code]

    This bit of code reads the palette directly from the videocard and stores the values in pal(x).red, pal(x).blue and pal(x).green. You could then write a routine that saves these values to another file,
    or you could append it to the BSAVE file.

    To get more info on this, look up a tut about palette-programming. The best tut on this I can remember is written by Denthor, and can be found on programmersheaven. The code he writes is in Pascal but can easily be ported to BASIC.

    I hope you can do something with this...

    Greetz, MainForze

    [edit] BTW, I assumed you were coding for SCREEN 13 ! [/edit]


    :Hello, World!
    : This is Dr. COM WIZ. As you know, I am in game production. I ran into yet anpother disturbing problem with graphics.
    :
    : I found an article on tile art and starting drawing a tile in a very good graphics program (ArtGem). I saved it in a GIF file expecting to be able to BSAVE and BLOAD it successfuly. I BSAVED it with the aid of a QBasic GIF file loader and everything seemed to be fine until I actually tried to BLOAD it in a different program. It was originally a grass tile (yes, the legendery grass tile) but, wen I PUT it, came out to be a square of randomly colored pixels. It worked OK when I PUT it in the same program I BSAVED it, but when I BLOADed on a different one, I got something equvilent to what would be made by this
    :
    : [code]
    : SCREEN 13
    : DO
    : PSET(16 * RND, 16 * RND), 16 * RND
    : LOOP
    : 'This program was not tested
    : [/code]
    :
    : Except it wasn't animated. It probably has something to do with the PALLETTE that the GIF Loader used. I don't know. Please help!
    : The GIF loader can be found at:
    : http://www.qbasic.com/files/gif.bas
    :
    : In the mean time, I'll try another GIF loader and see what happens.
    :
    :
    : This has been,
    : Dr. COM WIZ
    : PS Thank you and goodnight!
    :



  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    { http://forcoder.org } free ebooks and video tutorials about | Ruby, Java, Assembly, PHP, Visual Basic .NET, C++, C#, Delphi, Perl, JavaScript, Objective-C, PL/SQL, Scratch, C, R, MATLAB, Go, Visual Basic, Swift, Python ABAP, Fortran, Logo, F#, Crystal, LabVIEW, Julia, Clojure, Dart, Scheme, D, COBOL, Hack, SAS, Erlang, Scala, VBScript, Lisp, Lua, FoxPro, Ada, Kotlin, Alice, Transact-SQL, ML, Rust, Prolog, Apex, Bash, Awk | _____________

Sign In or Register to comment.