www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/20/17:28:43

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: allegro data file question.
Date: Thu, 20 Mar 1997 19:25:33 +0000
Organization: None
Distribution: world
Message-ID: <gWarCBAt8YMzEwRT@talula.demon.co.uk>
References: <Pine DOT SUN DOT 3 DOT 95 DOT 970319095240 DOT 10871A-100000 AT bert DOT eecs DOT uic DOT edu>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 30
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Andrew Deren writes:
>Is it possible in allegro to save the content of the data file after it
>has been opened. What I want to do is open a data file, change some stuff
>in there and save it back. Is there an easy way to do that?

Use the functions in tools/datedit.c (in particular the
datedit_save_datafile() function). This isn't part of the main lib, but
contains various helper routines that are used by the grabber, dat.exe,
and dat2s.exe. Look at the sources for those utilities for examples of
how it works...

The only thing to watch out for is that you won't be able to save
compiled sprites correctly. They are stored on disk as regular bitmap
images, in the interest of size and portability, and only compiled into
machine code instructions when the datafile is loaded into memory. There
is no easy way to reverse this conversion, so the original image can't
be recovered when you come to save the file (the grabber prevents such
sprites from being compiled when it reads in the file: email me
privately if you need details of how this works).

Be aware, though, that saving datafiles (particulary if you are
compressing them) takes quite a while, so you would probably be better
off saving your dynamic data in seperate files. The datafile format was
designed for bulky read-only data like bitmaps and sounds, not for
things that need to be modified each time the program is run...


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019