Page 1 of 1

BSave-BLoad III

Posted: Sat Feb 19, 2005 1:45 pm
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

Posted: Sat Feb 19, 2005 1:49 pm
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:

Posted: Sat Feb 19, 2005 1:53 pm
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

Posted: Sat Feb 19, 2005 2:21 pm
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!

Posted: Sat Feb 19, 2005 2:33 pm
by Rattrapmax6
Now c Nate, your not a loser.. I yet again learned something from you.. heh heh.. and hopefully Mitth will too.. :wink: ,.

Posted: Sat Feb 19, 2005 2:47 pm
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...

Posted: Sat Feb 19, 2005 3:11 pm
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.

Posted: Sat Feb 19, 2005 4:16 pm
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...

Posted: Sat Feb 19, 2005 7:15 pm
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.

Posted: Sun Feb 20, 2005 9:15 am
by Mitth'raw'nuruodo
Well, thank you

Posted: Sun Feb 20, 2005 9:40 am
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...