BSave-BLoad III

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

BSave-BLoad III

Post by Mitth'raw'nuruodo »

Well time for another Bsave/Bload question:

Can you Store more than one Bsaved sprite per file, if so how do you put it/retrive it using BSAVE/BLOAD. Also how do you find the sprite size needed for loading by using the LOF() command...Any source would be helpful too. Thanks.

The reason I want this because I don't want 50 .mit files (my BSAVE/BLOAD file type) in my .zip with my .exe program and my .txt files. Wow that's a rainbow of files! He he! :D
"But...It was so beutifully done"
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 »

PP256 stores more than one pic per file,.. but how I don't know... You could have the pics put in a dir file,. and load from there givin the dir file is in the same dir as the .EXE... great way to organize tell you get the info you need.. :wink:
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

Post by Mitth'raw'nuruodo »

Ummm...not what I was talking about, so your answer is I don't know for now.

Mabey Nek knows...wait of course Nek knows...Mabey he will grace this thread with his gracefullness...ummm...that didn't come out right...lol
"But...It was so beutifully done"
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

To save in one file, you need to get() in 1 array.

Code: Select all

screen 13
dim array(104) ' enough for 2 gets
'GFX STUFF HERE
get(0, 0)-(9, 9), array(0)
'SECOND PIC GFX STUFF HERE
get(0, 0)-(9, 9), array(53)
'bsave like you always do
Thats how to save. To load, do the same. To put the first pic, though, you do

Code: Select all

put(0, 0), array(0)
The second one:

Code: Select all

put(0, 0), array(53)
I coded by hand, so it might not work but should. I always code by hand... im to lazy!
Image
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 »

Now c Nate, your not a loser.. I yet again learned something from you.. heh heh.. and hopefully Mitth will too.. :wink: ,.
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

Post by Mitth'raw'nuruodo »

Grumble Grumble, Ya I guess I did...just kidding lol :lol: ...

Now for the bonus points and all the crackers in the cracker jacks...answer me this one question HOW THE HECK TO YOU KNOW WHAT ELEMENT IN THE ARRAY BEGINS ONE PIC AND WHAT ELEMENT DOES ANOTHER PIC?!

ie. image(0) = first pic
image(53) = second pic

How do you calculate the 53? I what I'm asking....if its not too much trouble...
"But...It was so beutifully done"
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

To find area of the pic:

length * width \ 2 + 2

So, to find the next picture:

length * width \ 2 + 2

It works becase you find the area, its compressed so divide by 2 and add 2 for the header.
Image
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

Post by Mitth'raw'nuruodo »

Or is it add one for the header, and another for the start position in line?

Cause Nek's formula is L*W/2+1. but to get eh next in line you would add 1 so you don't get the end of the first one.

ie.
picsize = 8
array(0) is the first
array(8) is the next one not the size but hmmm thanks anyways...
"But...It was so beutifully done"
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt »

For a single sprite, L * H / 2 + 1 works fine. But when you need to do exact offsets for multiple sprites, L * W / 2 + 2 is the value you use for the offset. That method only works for arrays with all the same sized images though...for arrays with sprites of multiple sizes, you'd be better off making a seperate array, one element per image in your sprite array, that keeps track of the indexes of each image. Of course, to get the indexes, you have to scan through the array and determine how large each image is, then figure out the offset for each one.
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

Post by Mitth'raw'nuruodo »

Well, thank you
"But...It was so beutifully done"
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

Post by Mitth'raw'nuruodo »

Ok, it worked but I decided not to do it like that unless if I could transfer each image data in the array to seperate arrays...
"But...It was so beutifully done"
Post Reply