Carrying 2-dimensional arrays across maps

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

Here's what I did:

Code: Select all

// group map stats into single global
for (int s2=0; s2 < 8; s2++) {
	g_ms[(GetLevelInfo(LEVELINFO_LEVELNUM)-1)*8 + s2] = mapstat[s2];
}
and

Code: Select all

// degroup from single global: [map][stat]
for (int m2=0; m2 < 10; m2++) {
	for (int s2=0; s2 < 8; s2++) {
		mapstat[m2][s2] = g_ms[(m2*8) + s2];
	}
}
If you know the sizes of the arrays, you can group them all into a single global, and then degroup them when starting another map.
User avatar
solarsnowfall
Posts: 1581
Joined: Thu Jun 30, 2005 1:44 am

Post by solarsnowfall »

SlayeR wrote:Global int 5:Player_Info[][] -- what's the 5 for?
IIRC you are limitted to 64 world and global variables. It can come in handy for keeping track of how many of them you have declared. But for any specific reason why they are numbered, I couldn't tell you.
Locked

Return to “Editing (Archive)”