Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/25/26 19:13
ZorroGPT
by TipmyPip. 04/25/26 16:09
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (AndrewAMD, Grant, valino), 3,361 guests, and 13 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: BMAP* to char ... and ... char to BMAP* ??? [Re: pegamode] #244285
01/03/09 20:14
01/03/09 20:14
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
not sure, but try these combos
pic.pixels[byt] = savegame->picture[byt];
or
pic.pixels[byt] = (savegame->picture)[byt];
or
(pic.pixels)[byt] = (savegame->picture)[byt];

Accessing arrayed structure elements is always a fuzzy part for me...

Also, make sure savegame->picsize is being saved correctly.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: BMAP* to char ... and ... char to BMAP* ??? [Re: EvilSOB] #244355
01/04/09 09:10
01/04/09 09:10
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hmmm ...

the first two combos end in a compiler error.

With the last one I get the same result as before ... crash in function.

savegame->picsize is correct, but the crash occurs with the first call of the line in the for-loop.

Maybe pic.pixels is read-only?

I also tried to use bmap_lock and bmap_unlock.

Any other idea?

Last edited by pegamode; 01/04/09 09:21.
Re: BMAP* to char ... and ... char to BMAP* ??? [Re: pegamode] #244358
01/04/09 09:38
01/04/09 09:38
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
As a workaround I'm currently using the following code:

I changed from char to var in the struct.

To save the picture in my struct:
Code:
bmap_lock(screenshot_pic,0);
int x=0;
int y=0;
int z=0;
for(y=1;y<=110;y++) {
  for(x=1;x<=245;x++) {  		
    savegame->picture[z] = pixel_for_bmap(screenshot_pic,x,y);
    z++;
  }
}
bmap_unlock(screenshot_pic);


And to load it back:
Code:
BMAP* pic = bmap_createblack(245,110,24);
bmap_lock(pic,0);  
int x=0;
int y=0;
int z=0;
for(y=1;y<=110;y++) {
  for(x=1;x<=245;x++) {
    pixel_to_bmap(pic,x,y,savegame->picture[z]);
    z++;
  }
}
bmap_unlock(pic);


This works fine, but I think the other version would be faster, wouldn't it?
But it seems writing directly into pic.pixels is crashing the engine.

Regards,
Pegamode.

Re: BMAP* to char ... and ... char to BMAP* ??? [Re: pegamode] #244457
01/04/09 20:22
01/04/09 20:22
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Hmm, yes mine would be much faster....if it was working!

I'll look into it today and actually compile and test this time.
I'll post back my results when Im done.

Sorry for the inconveniance.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: BMAP* to char ... and ... char to BMAP* ??? [Re: EvilSOB] #244480
01/04/09 23:56
01/04/09 23:56
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Dammit. Looks like this is a dead issue, except by using the
pixel_for_bmap and pixel_to_bmap functions, which are fairly slow.

BMAPs seem to jump back and forth with whether the ACTUAL data is stored
in the friendly *pixels data blocks and the evil *d3dtex data blocks,which are too complex.

I'll keep looking into it, but I dont have very high hopes, either on chance
of sucess OR time to resolve...

I'll give you a hand with pixel_for_bmap and pixel_to_bmap if you want, as a
savegame function doesnt really need speed.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: BMAP* to char ... and ... char to BMAP* ??? [Re: EvilSOB] #244509
01/05/09 08:12
01/05/09 08:12
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi EvilSOB,

thanks for your help and the time you spent in that issue.

My pixel_for_bmap and pixel_to_bmap code works fine so far and it is as you said, I don't need speed.

It would have been nice if the char-version was working, but in my case pixel_... functions work as well.

Maybe we should ask Conitec if there is a chance to get this working with using a char-array.

Regards,
Pegamode.

Re: BMAP* to char ... and ... char to BMAP* ??? [Re: pegamode] #244637
01/05/09 23:00
01/05/09 23:00
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
So why the preference of a CHAR array rather than a VAR array?
I only looked into this as I saw a potential shortcut for you that didnt pan out.

If you dont want to have VARs in your struct you could use FLOATs instead.
Change your struct to float picture[20000]; and replace you encoding line
savegame->picture[z] = pixel_for_bmap(screenshot_pic,x,y);
with
savegame->picture[z] = floatv(pixel_for_bmap(screenshot_pic,x,y));

and your decoding line
pixel_to_bmap(pic,x,y,savegame->picture[z]);
MAY need to change to
pixel_to_bmap(pic,x,y,(var)savegame->picture[z]);

Then all the data will be stored as a clean single FLOAT for every pixel.
Also would it possible be better to store the picture data is a TWO dimensional
array like this? float picture[245][110];


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: BMAP* to char ... and ... char to BMAP* ??? [Re: EvilSOB] #244686
01/06/09 09:58
01/06/09 09:58
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi EvilSOB,

I tried your idea to use float instead of var, but then all colors in the saved picture are wrong ?!?

So now I changed to var picture[245][110];

Re: BMAP* to char ... and ... char to BMAP* ??? [Re: pegamode] #244831
01/07/09 02:28
01/07/09 02:28
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Maybe
savegame->picture[z] = (float)pixel_for_bmap(screenshot_pic,x,y);
instead of
savegame->picture[z] = floatv(pixel_for_bmap(screenshot_pic,x,y));
Its possible the floatv function does something off to the pixel data.

But if you are happy with VAR's then its no propblem.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: BMAP* to char ... and ... char to BMAP* ??? [Re: EvilSOB] #244858
01/07/09 09:07
01/07/09 09:07
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
I think I can live with the VARs.

Thanks for your help.

Now I have all my data (screenshot included) in one single savegame file.
That's great.

Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1