www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/22/16:50:14

Message-ID: <362FB41E.84C29765@geocities.com>
From: Sahab Yazdani <sahaby AT geocities DOT com>
X-Mailer: Mozilla 4.5b2 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Level-map problem
References: <70o6mb$lec$1 AT cubacola DOT tninet DOT se>
Lines: 54
Date: Thu, 22 Oct 1998 17:39:26 -0500
NNTP-Posting-Host: 209.148.138.202
X-Complaints-To: abuse AT sprint DOT ca
X-Trace: HME2.newscontent-01.sprint.ca 909092797 209.148.138.202 (Thu, 22 Oct 1998 17:46:37 EDT)
NNTP-Posting-Date: Thu, 22 Oct 1998 17:46:37 EDT
Organization: Sprint Canada Inc.
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Since there is 256+ objects and under 512 (tiles) you should use 9 bit
long integers to get the information.

So what you might have is (this is presuming your using an unsigned char
type)

for (counter=0;counter<(7*10);counter++) {
	object_number = fgetc(in);
//	Your Function to put object_number into your object map object
possibly OBJECT_MAP[7][10]
	DoSomethingWithThisNumber( object_number, counter );
}

now if you were using 9 bit intergers you might be doing something like
this:

******************************************************
* 1  *  2  *  3  *  4  *  5  *  6  *  7  *  8  *  9  *
******************************************************
*   Object Number under 256                    * 1/0 *
******************************************************

so if bit 9 were 0 you would keep the number from bits 1-8 but if it
were 1 you would add 256 to the number from bits 1-8.  This just makes
the file size smaller but you could make it so that each tile takes up
two bytes of data...

I hope this helps

Leif Svensson wrote:
> 
> Hello!
> I´m writing a 2d game and I got a problem that I think that maybe someone
> out there can help me with.
> I´m having a problem with my map-system.
> It should read in which tile who is where (There are 70 of them (10*7) and
> then refer to a object to keep the map-files small. How do I do this?
> Do you got a better way to solve the whole map-file thing?
> I don´t want any graphics in the file, cause the file will be too big then.
> Hope you understand what I mean. If not, Tell me....
> 
> Waiting for an answer from a kind soul....
> // Patrik , Sweden
> 
> P.S: There´s over 450 tiles D.S

-- 
**********************************************************************
* Sahab Yazdani              *    Let the Dragon ride again on the   *
* Thornhill Secondary School *     winds of Time - Wheel of Time     *
**********************************************************************
* http://www.geocities.com/TimesSquare/Bunker/8994/index.html        *
* Click the link to visit my portion of The Neverhood                *
**********************************************************************

- Raw text -


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